Last active
August 29, 2015 14:19
-
-
Save bunnywong/a158b1b1f5060627ddbd to your computer and use it in GitHub Desktop.
Lunch together calc
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
#Detail | |
SELECT username,(cost) FROM posts, users | |
WHERE | |
consumer_id = 2 && | |
posts.payer_id = users.id && | |
payer_id <> 2 | |
#Summary | |
SELECT username,SUM(cost) FROM posts, users | |
WHERE | |
consumer_id = 2 && | |
posts.payer_id = users.id && | |
payer_id <> 2 | |
GROUP BY | |
username | |
----------- | |
#Detail | |
SELECT username, (cost) FROM posts, users | |
WHERE | |
consumer_id <> 2 && | |
posts.consumer_id = users.id && | |
payer_id = 2 | |
#Summary | |
SELECT username, SUM(cost) FROM posts, users | |
WHERE | |
consumer_id <> 2 && | |
posts.consumer_id = users.id && | |
payer_id = 2 | |
GROUP BY | |
username |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment