Created
December 7, 2012 21:47
-
-
Save chadwhitacre/4236798 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
SETUP_NEW_TIPS_TO = """ | |
INSERT INTO tips (ctime, tipper, tippee, amount) | |
SELECT DISTINCT ON (tipper) | |
min(ctime), tipper, %s AS tippee, sum(amount) | |
FROM tips | |
WHERE tippee=%s OR tippee=%s | |
GROUP BY tipper, mtime | |
ORDER BY tipper, mtime DESC; | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment