Re: Formatting a month in query output

Поиск
Список
Период
Сортировка
От Rodolfo J. Paiz
Тема Re: Formatting a month in query output
Дата
Msg-id 1106790009.5295.156.camel@rodolfo.gt.factorrent.com
обсуждение исходный текст
Ответ на Re: Formatting a month in query output  (Alexander Borkowski <alexander.borkowski@abri.une.edu.au>)
Ответы Re: Formatting a month in query output  (Alexander Borkowski <alexander.borkowski@abri.une.edu.au>)
Список pgsql-novice
On Thu, 2005-01-27 at 12:31 +1100, Alexander Borkowski wrote:
> Sorry, I totally missed the crucial point there. How about
>
> select date_trunc('month', date) as sort_month, to_char(date,'Mon YYYY')
> as month, count(num) as num, sum(hrs_total) as hours from flights group
> by sort_month, month order by sort_month asc;
>

flightlog=> select date_trunc('month', date) as sort_month, to_char
(date, 'Mon YYYY') as month, count(num) as num, sum(hrs_total) as hours
from flights group by sort_month, month order by sort_month asc;

     sort_month      |  month   | num | hours
---------------------+----------+-----+-------
 2003-08-01 00:00:00 | Aug 2003 |   4 |   5.6
 2003-09-01 00:00:00 | Sep 2003 |   2 |   3.5
 2003-10-01 00:00:00 | Oct 2003 |   2 |   4.2
 2003-11-01 00:00:00 | Nov 2003 |  10 |  17.7
 2003-12-01 00:00:00 | Dec 2003 |  10 |  16.4
 2004-01-01 00:00:00 | Jan 2004 |   9 |  13.3
 2004-02-01 00:00:00 | Feb 2004 |   6 |   9.3
 2004-03-01 00:00:00 | Mar 2004 |  10 |  12.2
 2004-04-01 00:00:00 | Apr 2004 |  11 |  17.4
 2004-05-01 00:00:00 | May 2004 |   5 |   7.3
 2004-06-01 00:00:00 | Jun 2004 |  10 |  16.5
 2004-07-01 00:00:00 | Jul 2004 |   8 |  10.4
 2004-08-01 00:00:00 | Aug 2004 |   8 |  13.0
 2004-09-01 00:00:00 | Sep 2004 |   8 |  10.3
 2004-10-01 00:00:00 | Oct 2004 |   2 |   2.5
 2004-11-01 00:00:00 | Nov 2004 |  10 |  17.4
 2004-12-01 00:00:00 | Dec 2004 |   5 |   8.9
 2005-01-01 00:00:00 | Jan 2005 |   4 |   6.0
(18 rows)

This would be perfect if we could get rid of that first column and only
display the rest. Is that possible?

Thanks for all the help.

--
Rodolfo J. Paiz <rpaiz@simpaticus.com>


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

Предыдущее
От: Alexander Borkowski
Дата:
Сообщение: Re: Formatting a month in query output
Следующее
От: Alexander Borkowski
Дата:
Сообщение: Re: Formatting a month in query output