select * from 子表 as A
where cID in (select top 5 cID from 子表 where fID = A.fID order by cID)
order by fID, cID
where cID in (select top 5 cID from 子表 where fID = A.fID order by cID)
order by fID, cID
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
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
select * from 子表 a
where a.id in
(select top 5 id from ta
where fid=a.fid
order by cid )
order by cid
where a.id in
(select top 5 id from ta
where fid=a.fid
order by cid )
order by cid
where a.id in
(select top 5 id from 子表
where fid=a.fid
order by cid )
order by cid