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.
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?
- What is the difference between a LATERAL JOIN and a subquery in PostgreSQL?
- 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
- SQL JOIN and different types of JOINs
- Optimize GROUP BY query to retrieve latest row per user
- Two SQL LEFT JOINS produce incorrect result
- Aggregate columns with additional (distinct) filters
- Computed / calculated / virtual / derived columns in PostgreSQL
- Index for finding an element in a JSON array
- Oracle “(+)” Operator
- Delete duplicate rows from small table
- Grouped LIMIT in PostgreSQL: show the first N rows for each group?
- Possible to perform cross-database queries with PostgreSQL?
- Transpose latest rows per user to columns
- get JOIN table as array of results with PostgreSQL/NodeJS
- Reset auto increment counter in postgres
- Pass multiple values in single parameter
- Implement paging (skip / take) functionality with this query
- Custom SERIAL / autoincrement per group of values
- Is it possible to make a recursive SQL query?
- SQL SELECT speed int vs varchar
- How to concatenate columns in a Postgres SELECT?
- Is there a way to define a named constant in a PostgreSQL query?
- Inner Join vs Natural Join vs USING clause: are there any advantages?
- Combine two columns and add into one new column
- How can I send email from PostgreSQL trigger?
- Calculate working hours between 2 dates in PostgreSQL
- Compute percents from SUM() in the same SELECT sql query
- SQL Between clause with strings columns
- Are there any way to execute a query inside the string value (like eval) in PostgreSQL?
- Select only rows by join tables max value
- PostgreSQL delete with inner join
- Sort NULL values to the end of a table
- Getting date list in a range in PostgreSQL
- How to compare the current row with next and previous row in PostgreSQL?
- Window Functions or Common Table Expressions: count previous rows within range
- How to find a table having a specific column in postgresql
- PostgreSQL: Case insensitive string comparison
- Why do multiple-table joins produce duplicate rows?
- PostgreSQL: Give all permissions to a user on a PostgreSQL database
- Timestamp Difference In Hours for PostgreSQL