Re: Orderby two different columns

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: Orderby two different columns
Дата
Msg-id 200006231607.e5NG7Ke23404@linda.lfix.co.uk
обсуждение исходный текст
Ответ на Orderby two different columns  ("Mitch Vincent" <mitch@venux.net>)
Список pgsql-sql
"Mitch Vincent" wrote: >I need to order search results by the two dates. Here is the problem.. > >They want whichever
dateis the most recent to appear on top.. If I do >'order by resubmitted desc,created desc' I get something like this :
>>Applicant Re-submitted Created >A  06/05/2000             12/31/1999 >B  06/05/2000             12/31/1999 >C
05/17/2000            02/09/2000 >D  05/17/2000             01/21/2000 >E  05/11/2000             01/27/2000 >F
05/11/2000            01/21/2000 >G  05/01/2000             12/31/1999 >H  04/28/2000             01/28/2000 >I
04/28/2000              01/12/2000 >J                                  05/23//2000 > > >Ok, see applicant J? I need him
tobe above C.. 
 

select * from table  order by case             when resubmitted > created then resubmitted             else created
     end    desc;
 

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
========================================   "Train up a child in the way he should go, and when he      is old, he will
notdepart from it."    Proverbs 22:6 
 




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Orderby two different columns
Следующее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: Using substr with user defined types