Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. use
  2. [AdventureWorksDW2012]
  3. go
  4.  
  5. ;WITH sales AS (
  6.  
  7. select d.OrderDateKey,
  8. SalesAmount = SUM(d.SalesAmount)
  9. from [dbo].[FactInternetSales] d
  10. group by d.OrderDateKey
  11. having SUM(d.SalesAmount)>10000
  12. )
  13.  
  14. select FirstOrderDateKey = MIN(OrderDateKey)
  15.  
  16. from sales
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement