Can you try?
select
Pharmacy_name as "Pharmacy"
,sum(qty_Name) as "Quantity",
max(CASE
WHEN Ship_Date between '2014-04-01' and '2014-04-30' THEN 'April 2014'
WHEN Ship_Date between '2014-05-01' and '2014-05-31' THEN 'May 2014'
WHEN Ship_Date between '2014-06-01' and '2014-06-31' THEN 'June 2014'
ELSE 'No Date'
END) as 'Month'
from [dbo].[DM_SP_SHIP]
where [SHIP_DATE] >= '2014-04-01' and [SHIP_DATE] <= '2014-06-30'
and Pharmacy_name is not null
group by
Pharmacy_Name
--Prashanth
No comments:
Post a Comment