Igor >I'm not sure I completely understand I'm not surprised re-reading my requirement. It isn't clear at all. I'll have a play with what you've given me first. Thank you very much...not only for the solution but also for your explanation which I really appreciate. Dean
On 17 December 2012 00:39, Igor Tandetnik <i...@tandetnik.org> wrote: > e-mail mgbg25171 <mgbg25...@blueyonder.co.uk> wrote: > > I have modified my program to have next time (not shown) as well as next > > date > > What I'd to know is... > > How do I order results firstly by earlest non-null/empty string next time > > (ALL DAYS HERE WILL BE TODAY) order and then BY earliest non-null/empty > > string nextdate order > > so... > > I end up with a list of records in call time order followed by a list of > > records beginning with the one called longest ago. > > I'm not sure I completely understand the requirement, but play with > something like this: > > order by (f.nexttime is null or f.nexttime=''), coalesce(f.nexttime, ''), > f.lastdate > > The first expression is boolean, its result is 0 or 1, so what it does is > separate all records into two groups, and sort the first one (the one for > which the expression is false) ahead of the second one (where the > expression is true). The other two expressions are each designed to sort > one of these groups without affecting the other. > -- > Igor Tandetnik > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users