1.相册里面有图片
2.我想获取最新的10个相册 并且每个相册抽5张图片出来
能一次性抽出来吗??请大家不吝赐教.
------解决方案--------------------
假设有一个相册表(相册ID 相册名字 创建时间......)
假设有一个图片表(图片ID 图片名字 图片内容 所属相册ID 上传时间......)
;with t
as(
select px=row_number()over(partition by 相册名字 order by 上传时间 desc),
图片ID,图片名字,图片内容
from (select top 10 * from 相册表 order by 创建时间 desc) as a,图片表 b
where a.相册ID=b.相册ID
)
select
* from t where px<=5
--一个思路