Created
September 29, 2022 08:20
-
-
Save pioz/8b966493bf24f39708481f2af59d27b3 to your computer and use it in GitHub Desktop.
Select records by ids and order by ids order
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 id FROM products WHERE id IN (2,1) ORDER BY array_position(array[2,1], id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment