I want to list my products in the database according to their id order in the array
My array
'{3,2,1}'::int[]
For example
SELECT id FROM product WHERE id = ANY ('{3,2,1}'::int[]);
This query gets the products with ordered by product id
|id|
|1 |
|2 |
|3 |
But i want to list my products ordered by index of the array ids. Like this :
|id|
|3 |
|2 |
|1 |
Is it possible to do this ? How can i do ?