jeudi 12 février 2015

Using SQLite Query method with Special Case Order

I have a query method that currently looks like this:



Cursor cursor = database.query(MySQLiteHelper.MY_TABLE, allColumns, null, null, null, null, null);


What I want to do is add an ORDER BY. But it's a bit complicated then a regular ORDER BY. So in the last parameter I want an order that says


my_order ASC WHEN my_order IS NOT '0'


I am not sure if this is the proper syatax of if I need a CASE or what.


I basically want it to order the my_order field by 1,2,3, etc, then anything that is zero comes last in no particular order. The my_order column is an INT.


How can I do this?


Aucun commentaire:

Enregistrer un commentaire