union query doubt: - Mailing list pgsql-sql

From javier garcia
Subject union query doubt:
Date
Msg-id 200212111616.gBBGG3Q29502@natura.cebas.csic.es
Whole thread Raw
Responses Re: union query doubt:  (Frank Bax <fbax@sympatico.ca>)
List pgsql-sql
Hi;
I've got a table with three fields: DATE, POINT, FLOW. The POINT field can 
have values among 1 and 6. So, for a same date I have six different points 
with the correspondings flows.
I would like to make a query to obtain something like:
DATE POINT1 POINT2 POINT3 POINT4 POINT5 POINT6

where for a date I have the flows data of the different points.

I think that I would need to establish different alias for the same field. Is 
this possible?

Perhaps something like:

SELECT date, flow AS POINT1 FROM samples WHERE POINT=1 
UNION ALL
SELECT date, flow AS POINT2 FROM samples WHERE POINT=2
UNION ALL
SELECT date, flow AS POINT3 FROM samples WHERE POINT=3
...;

and a SELECT over the result of this subselect, that groups by date, or so?

Thanks for you help.

Javier


pgsql-sql by date:

Previous
From: Frank Bax
Date:
Subject: Re: Backup to data base how ?
Next
From: Frank Bax
Date:
Subject: Re: union query doubt: