select * from 子表 as A 
  where cID in (select top 5 cID from 子表 where fID = A.fID order by cID)
  order by fID, cID

解决方案 »

  1.   

    select * from 子表 as A 
      where cID in (select top 5 cID from 子表 where fID = A.fID and fid in (select fid from 主表) order by cID)
      order by fID, cID
      

  2.   

    select * from 子表 as A 
      where cID in (select top 5 cID from 子表 where fID = A.fID order by cID)
            and fID in (select fid from 主表)
      order by fID, cID
      

  3.   

    select * from 子表 order by id
    select * from 子表 a 
    where a.id in 
    (select top 5  id from ta 
                    where fid=a.fid
                    order by cid )
    order by cid
      

  4.   

    select * from 子表 a 
    where a.id in 
    (select top 5  id from ta 
                    where fid=a.fid
                    order by cid )
    order by cid
      

  5.   

    select * from 子表 a 
    where a.id in 
    (select top 5  id from 子表  
                    where fid=a.fid
                    order by cid )
    order by cid
      

  6.   

    看来只能用 Sub Query 了