Total sales per month

前端 未结 4 529
时光取名叫无心
时光取名叫无心 2021-02-05 10:20

I think this is common, is it?

If you have a table with SALES {Customer_ID, Price, SmallDateTime date}. How do you report all sales per month?



        
4条回答
  •  忘了有多久
    2021-02-05 11:08

    Try this

    SELECT A.CAL_YEAR AS YEAR  ,A.CAL_WEEK AS WEEK,SUM(B.SUM_OF_PROFIT) as profit FROM
    CALANDER A,SALES_FACT B WHERE A.DATE_ID=B.DATE_ID
    GROUP BY A.CAL_YEAR,A.CAL_WEEK;
    

提交回复
热议问题