I have a SQLite database in android with some tables, one of them is this:
trainings (date TEXT, exercise TEXT, repetitions INTEGER, weight REAL)
and it has two indexes in weight and repetitions both are ASC.
This is the thing, In a select statement with order by repetitions I got something like this:
Select * from trainings WHERE exercise='"+exercise+"' AND repetitions != '-' AND repetitions != 0 ORDER BY COALESCE( weight, date);
0
0
0
12
13
25
-
-
I want to know if it’s possible to put the ‘-‘ results at the beggining rather than at the end, because in my app, I treat 0 and ‘-‘ as the same thing and I have to get ordering getting this two datas together.
Any suggestions? Thanks in advance
To transform arbitrary values into other arbitrary values, use the CASE expression; something like this: