Skip to content

Instantly share code, notes, and snippets.

@yancya
Last active November 16, 2017 05:26
Show Gist options
  • Save yancya/5af6bedee63059333e1447a783f936d0 to your computer and use it in GitHub Desktop.
Save yancya/5af6bedee63059333e1447a783f936d0 to your computer and use it in GitHub Desktop.
WITH local_card_ids(id, "order") AS (VALUES(1, 0), (2, 1), (3, 2), (4, 3), (5, 4))
SELECT cache.cards.*
FROM cache.cards
JOIN local_card_ids USING(id)
ORDER BY local_card_ids."order";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment