union query doubt:
От | javier garcia |
---|---|
Тема | union query doubt: |
Дата | |
Msg-id | 200212111616.gBBGG3Q29502@natura.cebas.csic.es обсуждение исходный текст |
Ответы |
Re: union query doubt:
|
Список | 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 по дате отправления: