Re: Adhoc sorting requirement

2009-07-02 Thread Ravindra Harige
Thanks Nathan for the quick reply. will try this and report back.. :) Regards, Ravi On Thu, Jul 2, 2009 at 11:51 PM, Nathan Sullivan wrote: > Ravindra, > > Sorry, made a mistake in my last post. Meant to write: > > order by > case > when (date_field_3 between date(current_timestamp) and > date(d

RE: Adhoc sorting requirement

2009-07-02 Thread Nathan Sullivan
Ravindra, Sorry, made a mistake in my last post. Meant to write: order by case when (date_field_3 between date(current_timestamp) and date(date_add(current_timestamp, interval 2 day))) then 1 when (date_field_2 between date(current_timestamp) and date(date_add(current_timestamp, interval 2 day

RE: Adhoc sorting requirement

2009-07-02 Thread Nathan Sullivan
Ravindra, Maybe something like this? order by case when (date_field_1 between date(current_timestamp) and date(date_add(current_timestamp, interval 2 day))) then 1 when (date_field_2 between date(current_timestamp) and date(date_add(current_timestamp, interval 2 day))) then 2 when (date_field_3

Adhoc sorting requirement

2009-07-02 Thread Ravindra Harige
Hi, I have a very ad hoc sorting requirement and would like to know how this can be achieved. The requirement is as follows: I have a table (of say 100 records) with 3 DATE fields: date_field_1 , date_field_2 , date_field_3 I have a date range, for eg. from (today) to (today+2) and Each one of th