From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "Tom Allison" <tom(at)tacocat(dot)net> |
Cc: | "PostgreSQL General \(\(EN\)\)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: stuck on values in 8.2 |
Date: | 2007-05-12 15:08:12 |
Message-ID: | 874pmi84gz.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Tom Allison" <tom(at)tacocat(dot)net> writes:
> OK, after reviewing many emails and what I was trying to do I upgraded from 8.2.
>
> Seems to work as it did in 8.1 which is a good start.
>
> I'm doing all of this so I can use the 'values' that was described as being
> something like:
>
> select * from (values ('one','two','three')) "foo";
SELECT * FROM (VALUES ('one'),('two'),('three')) AS foo(value)
> I initially thought that I could do this with:
> select t.value, v.value from
> values('one','two','three') left outer join mytable using (value)
postgres=# SELECT *
FROM (VALUES ('one'),('two'),('three')) AS foo(value)
LEFT OUTER JOIN mytable ON (foo.value = mytable.value);
value | value
-------+-------
one |
two | two
three | three
(3 rows)
"USING" would work too but then you only get one output column rather than two
which is not so helpful in this case.
postgres=# SELECT *
FROM (VALUES ('one'),('two'),('three')) AS foo(value)
LEFT OUTER JOIN mytable USING (value) ;
value
-------
one
two
three
(3 rows)
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Lincoln Yeoh | 2007-05-12 15:27:43 | Re: Streaming large data into postgres [WORM like applications] |
Previous Message | Martijn van Oosterhout | 2007-05-12 15:01:13 | Re: postgres upgrade |