Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create a subquery in PostgreSQL
/**
* comments
* author
* comment_text
* created_at
**/
SELECT author, created_at FROM
(SELECT * FROM comments WHERE (created_at >= NOW() - interval '6 month')
ORDER BY created_at DESC LIMIT 100) subquery
ORDER BY author ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.