Skip to content

Instantly share code, notes, and snippets.

@vanstee
Created December 14, 2013 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanstee/7955209 to your computer and use it in GitHub Desktop.
Save vanstee/7955209 to your computer and use it in GitHub Desktop.
Booking.where('LOWER(duration) > ?', 10.weeks.ago).
group("DATE_TRUNC('week', LOWER(duration))").
pluck("DATE_TRUNC('week', LOWER(duration)) AS week, COUNT(DISTINCT(bookings.*))")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment