Re: Fake table name?
| От | Tom Lane |
|---|---|
| Тема | Re: Fake table name? |
| Дата | |
| Msg-id | 16839.970549306@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Fake table name? ("Roderick A. Anderson" <raanders@altoplanos.net>) |
| Ответы |
Re: Fake table name?
|
| Список | pgsql-general |
"Roderick A. Anderson" <raanders@altoplanos.net> writes:
> select tbl_key, equipname from equipment
> UNION
> select 'All', 'All Equipment' from ???
Postgres has a cleaner answer than a fake table; just omit the
FROM clause:
regression=# create table equipment(tbl_key text, equipname text);
CREATE
regression=# select tbl_key, equipname from equipment
regression-# UNION
regression-# select 'All', 'All Equipment';
tbl_key | equipname
---------+---------------
All | All Equipment
(1 row)
In some cases you might need to explicitly assign a datatype to the
literals, eg 'All'::text, but in the above example it should work
without that.
regards, tom lane
В списке pgsql-general по дате отправления: