SELECT t.*
FROM unnest(ARRAY[1,2,3,2,3,5]) item_id
LEFT JOIN items t on t.id=item_id
The above query select items from items
table with ids: 1,2,3,2,3,5 in that order.
More Related Contents:
- PostgreSQL unnest() with element number
- Check if value exists in Postgres array
- Return multiple columns of the same row as JSON array of objects
- Normalize array subscripts so they start with 1
- Is there something like a zip() function in PostgreSQL that combines two arrays?
- Selecting data into a Postgres array
- Call a set-returning function with an array argument multiple times
- Record returned from function has columns concatenated
- Explain JOIN vs. LEFT JOIN and WHERE condition performance suggestion in more detail
- Multiple array_agg() calls in a single query
- How to store array or multiple values in one column
- What is the difference between a LATERAL JOIN and a subquery in PostgreSQL?
- Check if NULL exists in Postgres array
- Join a count query on generate_series() and retrieve Null values as ‘0’
- What is the result of following SQL Query?
- Join vs. sub-query
- Refactor a PL/pgSQL function to return the output of various SELECT queries
- Can I use CASE statement in a JOIN condition?
- Subqueries vs joins
- Index for finding an element in a JSON array
- What is the expected behaviour for multiple set-returning functions in SELECT clause?
- Column ‘mary’ does not exist
- Is a JOIN faster than a WHERE?
- Get top row(s) with highest value, with ties
- Delete parent if it’s not referenced by any other child
- Postgres – Function to return the intersection of 2 ARRAYs?
- Table or column name cannot start with numeric?
- Count cumulative total in Postgresql
- Postgresql query between date ranges
- Why isn’t row level security enabled for Postgres views?