Skip to content

Instantly share code, notes, and snippets.

@silasjmatson
Created June 15, 2017 02:38
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 silasjmatson/5e11b25aae3edb82c3c622116af6880f to your computer and use it in GitHub Desktop.
Save silasjmatson/5e11b25aae3edb82c3c622116af6880f to your computer and use it in GitHub Desktop.
Custom Select
query.select("
AVG(sale.price) as average_price,
MAX(sale.price) as max_price,
MIN(sale.price) as min_price,
ROUND(AVG(EXTRACT(EPOCH FROM sale.completed_at) - EXTRACT(EPOCH FROM sale.created_at))) as average_sale_time
")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment