A
aaronevans
Unregistered / Unconfirmed
GUEST, unregistred user!
语句如下
第一语句是用来按条件累和的,第二个是全累和,能过第一个累和除以第二个累和等到一个表,再把这个表同第一个语句等出的表进行组合。
想着应该很简单,就是不知道如何做,那位帮帮我啊!
select s_posid,s_cashid,sum(f_ct) as sum_f_ct,sum(f_saleamt ) as sum_f_saleamt
from rep_d_salecash
where s_repdt between '2006/01/01' and '2006/01/02'
group by s_posid,s_cashid
select sum(f_ct) as sum_f_ct,sum(f_saleamt ) as sum_f_saleamt
from rep_d_salecash
where s_repdt between '2006/01/01' and '2006/01/02'
第一语句是用来按条件累和的,第二个是全累和,能过第一个累和除以第二个累和等到一个表,再把这个表同第一个语句等出的表进行组合。
想着应该很简单,就是不知道如何做,那位帮帮我啊!
select s_posid,s_cashid,sum(f_ct) as sum_f_ct,sum(f_saleamt ) as sum_f_saleamt
from rep_d_salecash
where s_repdt between '2006/01/01' and '2006/01/02'
group by s_posid,s_cashid
select sum(f_ct) as sum_f_ct,sum(f_saleamt ) as sum_f_saleamt
from rep_d_salecash
where s_repdt between '2006/01/01' and '2006/01/02'