e-mail mgbg25171 <[email protected]> wrote:
>> order by (f.nexttime is null or f.nexttime=''), coalesce(f.nexttime,
>> ''),f.lastdate
>
> This worked fine re making sure that non-null nexttimes come BEFORE null
> nexttimes.
>
> How would I extend this so that AFTER non-null nexttimes I get NON-NULL
> lasttimes and then...
> null nexttimes and lastimes in any order
order by (case
when nexttime is not null then 0
when lasttime is not null then 1
else 2 end), nexttime, lasttime
> Also can I ask why you are ordering by nextime is null/'' at the
> beginning...
Because that's what you asked for. Allow me to quote: "order results firstly by
earlest *non-null/empty string* next time" (emphasis mine). You do realize that
NULL and empty string are two distinct values, right?
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users