From: | Yaser Raja <yrraja(at)gmail(dot)com> |
---|---|
To: | David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Split the result of a query in 2 rows |
Date: | 2015-03-04 18:49:57 |
Message-ID: | CALkbEVnEyjPzQpamuDL-bpxrFRUbJq_nhSXb5ionXmkpAivLog@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)g(dot)johnston(at)gmail(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Pinto | 2015-03-04 18:53:03 | Re: Split the result of a query in 2 rows |
Previous Message | David G Johnston | 2015-03-04 18:46:45 | Re: Split the result of a query in 2 rows |