Guest User

Untitled

a guest
Mar 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. SELECT count(*) AS thirty_day_sales FROM "MySchema"."MyTable" MT
  2. WHERE MT.date > now()::date - interval '30 days'
  3. UNION
  4. SELECT count(*) AS sixty_day_sales FROM "MySchema"."MyTable" MT
  5. WHERE MT.date > now()::date - interval '60 days'
  6. UNION
  7. SELECT count(*) AS ninety_day_sales FROM "MySchema"."MyTable" MT
  8. WHERE MT.date > now()::date - interval '90 days'
Add Comment
Please, Sign In to add comment