SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: Gary Stout on February 06, 2011, 04:19:59 pm

Title: Order by question.....
Post by: Gary Stout on February 06, 2011, 04:19:59 pm
This is really going out on a limb, and if it is not possible, I think I have another solution in mind, but I have a column in one of my tables called "Family Position". This column only contains 3 values, Head of House, Spouse, Child. Is it possible to have the results that are displayed in a listview "ordered by" Head of House, Spouse and then Child? Right now the results are ordered by Last Name and then First Name.

Thanks again,
Gary
Title: Re: Order by question.....
Post by: Fred Meier on February 06, 2011, 05:29:55 pm
Try this
Order by case FamilyPosition when 'Head of House' then '1' when 'Spouse' then '2' else '3' end"
SQLite has many helpful experssions http://www.sqlite.org/lang_expr.html
Title: Re: Order by question.....
Post by: Gary Stout on February 06, 2011, 07:17:15 pm
Thanks Fred,

I will give that a try. My other thought was just to change the info in that field to either 1,2, or 3 and sort it based on those values. I use that field for a couple different purposes.

Thanks again,
Gary