22,209
社区成员
发帖
与我相关
我的任务
分享
select top 4 Books_Cid,sum(Books_volume)
as salink from Books t where (select *from Indent where Indent_State='0' and Indent_Time between '2012-02-1 00:00:00' and '2012-02-31 00:00:00')
Books_Cid like '102%' group by Books_Cid order by salink desc
select *from Indent where Indent_State='0' and Indent_Time between '2012-02-1 00:00:00' and '2012-02-31 00:00:00'
--try
select top 4 Books_Cid,
sum(Books_volume)as salink
from Books t
where exists(select 1
from Indent
where Indent_State='0' and Indent_Time between '2012-02-1 00:00:00' and '2012-02-31 00:00:00'
and Indent_Bid=t.Books_id)
and
Books_Cid like '102%' group by Books_Cid order by salink desc