Re: stuck on values in 8.2
| От | Gregory Stark |
|---|---|
| Тема | Re: stuck on values in 8.2 |
| Дата | |
| Msg-id | 874pmi84gz.fsf@oxford.xeocode.com обсуждение исходный текст |
| Ответ на | stuck on values in 8.2 (Tom Allison <tom@tacocat.net>) |
| Ответы |
Re: stuck on values in 8.2
|
| Список | pgsql-general |
"Tom Allison" <tom@tacocat.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
В списке pgsql-general по дате отправления: