aravindhan_3
07-29-2011, 02:24 AM
Hi I need your help for onle of my SQL query
I have SQL query like this
Select
Week_Number As Week,
Store_Number,
Department,
Sum(Sales) As Sales
From
Sales_Table
Where Store_Number In (1,2,3)
And Department In ('A','B','C')
and Week_Number = 1
Group By 1,2,3
This would give me the sales number only for the stores & department which are there in the where clause. If no sales available for the store 2 the that will not be shown in the output.
But I need that store also on the result but with zero value, that is look data for all the stores in the where clause, if sales exists get the sales else get zero
I have attached the excel sheet for which clearly shows my requirement.
Thanks for your help
I have SQL query like this
Select
Week_Number As Week,
Store_Number,
Department,
Sum(Sales) As Sales
From
Sales_Table
Where Store_Number In (1,2,3)
And Department In ('A','B','C')
and Week_Number = 1
Group By 1,2,3
This would give me the sales number only for the stores & department which are there in the where clause. If no sales available for the store 2 the that will not be shown in the output.
But I need that store also on the result but with zero value, that is look data for all the stores in the where clause, if sales exists get the sales else get zero
I have attached the excel sheet for which clearly shows my requirement.
Thanks for your help