Re: Split the result of a query in 2 rows

Поиск
Список
Период
Сортировка
От Yaser Raja
Тема Re: Split the result of a query in 2 rows
Дата
Msg-id CALkbEVnEyjPzQpamuDL-bpxrFRUbJq_nhSXb5ionXmkpAivLog@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Split the result of a query in 2 rows  (David G Johnston <david.g.johnston@gmail.com>)
Список pgsql-novice
You can using UNION ALL operator for this task:

SELECT field1 FROM tbl_table 
UNION ALL 
SELECT field2 FROM tbl_table 
ORDER BY 1;

If you do not want duplicates use UNION instead of UNION ALL.

Regards
Yaser

On Wed, Mar 4, 2015 at 1:46 PM, David G Johnston <david.g.johnston@gmail.com> wrote:
JORGE MALDONADO wrote
> I have a very simple query to a single table as follows:
>
> SELECT field1, field2 FROM tbl_table ORDER BY field1
>
> Is it possible to "split" the results so field1 is displayed in one row
> and
> field2 in another row?
>
> Best regards,
> Jorge Maldonado

See "UNION ALL"

David J.




--
View this message in context: http://postgresql.nabble.com/Split-the-result-of-a-query-in-2-rows-tp5840497p5840502.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

В списке pgsql-novice по дате отправления:

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: Split the result of a query in 2 rows
Следующее
От: Frank Pinto
Дата:
Сообщение: Re: Split the result of a query in 2 rows