complex column definition in query

Поиск
Список
Период
Сортировка
От Seb
Тема complex column definition in query
Дата
Msg-id 87iqjep9hy.fsf@patagonia.sebmags.homelinux.org
обсуждение исходный текст
Ответы Re: complex column definition in query  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-sql
Hi,

Say we have a table:

SELECT * FROM weather;    city      | temp_lo | temp_hi | prcp  
---------------+---------+---------+-------San Francisco |      46 |      50 | 0.25 San Francisco |      43 |      57 |
  0 Hayward       |      37 |      54 |      Hayward       |      30 |      58 |      Somewhere     |      25 |      60
|     Somewhere     |      28 |      50 |      
 
(6 rows)

I'm struggling to build a query with a column temp, where the first row
is the lowest temp_lo followed by all the temp_hi for each city.  So
this would be the output:
    city      | temp  
---------------+------San Francisco |   43San Francisco |   50 San Francisco |   57 Hayward       |   30Hayward       |
 54 Hayward       |   58 Somewhere     |   25Somewhere     |   60 Somewhere     |   50 
 
(6 rows)

Any ideas appreciated!  Thanks.


Cheers,

-- 
Seb



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [DOCS] proposal for a CookBook in postgresql.org
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [DOCS] proposal for a CookBook in postgresql.org