Re: Select/Group by/Order by question

Поиск
Список
Период
Сортировка
Искать
От
Mike Nolan
Тема
Re: Select/Group by/Order by question
Дата
Msg-id
200404090623.i396NTjP022301@gw.tssi.com
Ответ на
Список
Дерево обсуждения
Re: Select/Group by/Order by question "Michael Fork" <mfork00@yahoo.com>
Re: Select/Group by/Order by question Mike Nolan <nolan@gw.tssi.com>
> You are grouping/ordering by the textual result of to_char(),
> in which PM naturally follows AM.  I think the behavior you
> want would come from grouping/ordering by the underlying
> timestamp column "mtrantime".

Well, I need it grouped by hour, but that led me to the solution:

select to_char(date_trunc('hour',mtrantime),'mm-dd hh AM') as
datetime, count(*) as tot, from memtran 
group by mtranoper, date_trunc('hour',mtrantime)
order by mtranoper, date_trunc('hour',mtrantime)

I knew there had to be a straight-forward solution.  Thanks Tom.
--
Mike Nolan
В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: pg_ctl problem
От: Hitesh Bagadiya
Дата:
Сообщение: Sorting in Unicode not working
FAQ