Skip to content

Instantly share code, notes, and snippets.

@ABM-Dan
Created April 6, 2016 22:12
Show Gist options
  • Select an option

  • Save ABM-Dan/2e1784c53a1617435b456de75387dd38 to your computer and use it in GitHub Desktop.

Select an option

Save ABM-Dan/2e1784c53a1617435b456de75387dd38 to your computer and use it in GitHub Desktop.
SELECT
w.customer_id,
b.*
FROM l
INNER JOIN b ON l.id = b.lot_id
LEFT JOIN w ON l.id = w.lot_id
AND w.customer_id = b.customer_id
WHERE b.customer_id = 17
# AND b.active = 1
ORDER BY l.sale_ts ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment