You can write like this

回答: Please help in SQL code and Thank youluck20102011-01-08 16:28:50

I didn't try to run, but I think you can get the idea if I have some syntax error:

select
c.cust_nam, 
totqty
from
customers c join

(select sum(s.qty_sold) as totqty, cust_id from sales s
where s.sale_dat >= ‘20100101’,
s.sale_dat <= ‘20101231’ group by
cust_id) cnt
c.cust_id = cnt.cust_id,

請您先登陸,再發跟帖!