当前位置: 代码迷 >> SQL >> SQL 话语统计
  详细解决方案

SQL 话语统计

热度:62   发布时间:2016-05-05 13:27:43.0
SQL 语句统计
select A.foodhead_recordman  as,  (select sum(G.groupinfo_je) from groupinfo G  where A.foodhead_id=G.foodhead_id ) as 'tchj', (select sum(F.singleinfo_je) from singleinfo F where A.foodhead_id=F.foodhead_id ) as 'dchj', sum(A.FOODHEAD_FACT_PRICE) as 'ysje' , sum(A.FOODHEAD_PREFERENTIAL_PRICE) as 'ssje', sum(A.FOODHEAD_PAY_AGIO) as 'zhekouje', (select sum(B.PAYWAY_JE) from payways B where A.foodhead_id=B.foodhead_id and  B.payway_name=1) as 'xianjin',  (select sum(B.PAYWAY_JE) from payways B where A.foodhead_id=B.foodhead_id and  B.payway_name=2) as 'huiyuanka' from foodhead A ,payways B where A.foodhead_id=B.foodhead_id  and convert(A.foodhead_date,date)>='2010-05-24' and convert(A.foodhead_date,date)<='2010-06-01' group by  A.foodhead_recordmanselect A.foodhead_recordman , sum(A.FOODHEAD_FACT_PRICE) as 'ysje', sum(A.FOODHEAD_PREFERENTIAL_PRICE) as 'ssje', sum(A.FOODHEAD_PAY_AGIO) as 'zkje', (select sum(B.PAYWAY_JE) from payways B where A.foodhead_id=B.foodhead_id and  B.payway_name=1 ) as 'xianjin',  (select sum(B.PAYWAY_JE) from payways B where A.foodhead_id=B.foodhead_id and  B.payway_name=2 ) as 'huiyuanka' from foodhead A ,payways B where A.foodhead_id=B.foodhead_id and convert(A.foodhead_date,date)>='2010-05-24' group by  A.foodhead_recordmanselect A.class_id , count(A.foodhead_id) as 'ds', sum(A.FOODHEAD_FACT_PRICE) as 'ysje' ,  sum(A.FOODHEAD_PREFERENTIAL_PRICE) as 'ssje', sum(A.FOODHEAD_PAY_AGIO) as 'zkje',   (select sum(B.PAYWAY_JE) from payways B where A.foodhead_id=B.foodhead_id and  B.payway_name=1 ) as 'xianjin',   (select sum(B.PAYWAY_JE) from payways B where A.foodhead_id=B.foodhead_id and  B.payway_name=2 ) as 'huiyuanka'   from foodhead A ,payways B where A.foodhead_id=B.foodhead_id and convert(A.foodhead_date,date)>='2010-05-24'  group by  A.class_id select convert(A.foodhead_date,date) as '时间' from foodhead A where convert(A.foodhead_date,date) = '2010-05-24'  select convert(A.foodhead_date,date) as '时间' from foodhead A  where convert(A.foodhead_date,date) >'2010-05-20' and convert(A.foodhead_date,date) <='2010-05-31'select E.foodhead_recordman, sum(F.singleinfo_je) from foodhead E ,singleinfo F where E.foodhead_id=F.foodhead_id  group by E.foodhead_recordmanselect E.foodhead_recordman, sum(G.groupinfo_je) from foodhead E ,groupinfo G  where E.foodhead_id=G.foodhead_id group by E.foodhead_recordmanselect sum(B.PAYWAY_JE) from foodhead A ,payways B where A.foodhead_id=B.foodhead_id and convert(A.foodhead_date,date)= '2010-05-24' and  B.payway_name=1select sum(B.PAYWAY_JE) from foodhead A ,payways B where A.foodhead_id=B.foodhead_id and convert(A.foodhead_date,date)= '2010-05-24' and  B.payway_name=2 

?

  相关解决方案