Author |
Topic |
jdeforums
Starting Member
8 Posts |
Posted - 2014-02-13 : 06:04:59
|
Hi ,I have query to download sale summary value in monthwise, but now i want to include previous days sale and total sales as mentioned below format .Sales Type Month_sales3rd Domes XXX3rd Export XXXInter Domes XXXBut i wantSales Type Yesterda_Sales Month_sales3rd Domes XXX XXX3rd Export XXX XXXInter Domes XXX XXXCurrent query is select ABAC29_DESC as Sales,ABAC30_DESC as Type , round(sum(order_qty*UNIT)/1000000,2) as MTD_Sales_Million from saleswheredatediff(month,invoice_date,getdate())<=0request your help to include the yesterday sales also.ThanksSuresh.K.P |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-02-13 : 07:47:58
|
[code]select ABAC29_DESC as Sales, ABAC30_DESC as Type, round(sum(case when invoice_date = dateadd(day, datediff(day, 0, getdate()), -1) then order_qty*UNIT else 0 end)/1000000, 2) as YESTERDAY_Sales_Million round(sum(order_qty*UNIT)/1000000,2) as MTD_Sales_Million from saleswhere invoice_date >= dateadd(month, datediff(month, 0, getdate()), 0)and invoice_date < dateadd(month, datediff(month, 0, getdate()) + 1, 0)group by ABAC29_DESC, ABAC30_DESC[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
jdeforums
Starting Member
8 Posts |
Posted - 2014-02-15 : 02:02:07
|
quote: Originally posted by khtan
select ABAC29_DESC as Sales, ABAC30_DESC as Type, round(sum(case when invoice_date = dateadd(day, datediff(day, 0, getdate()), -1) then order_qty*UNIT else 0 end)/1000000, 2) as YESTERDAY_Sales_Million round(sum(order_qty*UNIT)/1000000,2) as MTD_Sales_Million from saleswhere invoice_date >= dateadd(month, datediff(month, 0, getdate()), 0)and invoice_date < dateadd(month, datediff(month, 0, getdate()) + 1, 0)group by ABAC29_DESC, ABAC30_DESC KH[spoiler]Time is always against us[/spoiler]
Many Thanks KH.Suresh.K.P |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-02-15 : 02:09:08
|
you are welcome KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|