Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Account Jan Feb Mar Apr etc…
- 101 1
- 101 2
- 102 3
- 103 4
- 103 5
- Account Jan Feb Mar Apr etc…
- 101 2
- 102 3
- 103 3
- 104 2
- 105 3
- SELECT [NewSalesHistory].[Region]
- ,[NewSalesHistory].[ShipTo]
- ,SUM(case when [NewSalesHistory].[billingdate] between '6/1/2016' and '6/30/2016' then newbillingdata else 0 end ) + [X].[Jun-16] AS 'Jun-16'
- FROM [NewSalesHistory]
- FULL join (SELECT [Shipto]
- ,SUM(case when [BWLease].[billingdate] between '6/1/2016' and '6/30/2016' then ExtPrice else 0 end ) as 'Jun-16'
- FROM [AirgasPricing].[dbo].[BWLease]
- GROUP BY [Shipto]) X ON [NewSalesHistory].[ShipTo] = [X].[Shipto]
- GROUP BY [NewSalesHistory].[Region]
- ,[NewSalesHistory].[ShipTo]
- ,[X].[Jun-16]
Add Comment
Please, Sign In to add comment