- Home
- PostgreSQL
- PostgreSQL Inline Tables
PostgreSQL Inline Tables
It can often be helpful to select data as an inline table to join against another table for additional values.
An inline table can be formed like so:
SELECT * FROM (VALUES (1, 101), (2, 202), (3, 303), (4, 304) ) as i(val, qnt);
A common use case is to do a join against another table using your inline table as a starting point:
SELECT * FROM (VALUES (1, 101), (2, 202), (3, 303), (4, 304) ) as i(val, qnt) LEFT JOIN other_table on other_table.val = i.val;