谁能告诉我这个怎么才可以实现,线上等!!!!!!
select top 6 id,title from Titles Where (Id3=10 or Id3=11) and Pass=1 order by addtime desc
原来是这样的
无论Id3=10 还是Id3=11都是出自一章表..现在要求是,
当等于10的时候取3条记录.当等于11的时候取3条记录
然后查出结果,我要数据绑定,,所以还必须是一个select语句实现
我老大说用group..可是我没有思路也没有做过...
请各位大虾帮忙,,,在线等!
------解决方案--------------------select * from (select top 3 id,title from Titles Where Id3=10 and Pass=1 order by addtime desc) T1
union all
select * from (select top 3 id,title from Titles Where Id3=11 and Pass=1 order by addtime desc) T2
------解决方案--------------------select * from(
select top 3 id,title from Titles where Id3=10 order by addtime desc)a
union all
select * from(
select top 3 id,title from Titles where Id3=11 order by addtime desc)b