Created
December 19, 2013 08:26
-
-
Save parshap/8036111 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select sum(transactions.price) from sellers | |
left join products on products.seller_id = sellers.id | |
left join purchases on purchases.product_id = products.id | |
left join transactions on transactions.purchase_id = purchases.id | |
where sellers.id = SELLER_ID and | |
transactions.is_payed = 0 and | |
transactions.date <= date_sub(now(), interval 1 week) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment