shaleve
May 25th, 2009, 02:26 AM
I am looking for the correct syntax to use a small inline table in a query.
So far I am using:
SELECT * FROM
(select 20148 as id
union all select 20149
union all select 20152
union all select 20153
) as InlineTable
LEFT JOIN SomeOtherTable USING (id);
This can get quite messy if the table is longer (I recenlty needed a table with 40 lines )
Is there a shorter syntax to create such an inline table?
I am working with postgresql 8.3
So far I am using:
SELECT * FROM
(select 20148 as id
union all select 20149
union all select 20152
union all select 20153
) as InlineTable
LEFT JOIN SomeOtherTable USING (id);
This can get quite messy if the table is longer (I recenlty needed a table with 40 lines )
Is there a shorter syntax to create such an inline table?
I am working with postgresql 8.3