Reputation: 497
i am using sqlite in android application. there is one table with some columns . ex:-
columns :- Id name url watched
watched has boolean values . When i query it returns a Cursor, in the Cursor i want all the records where "watched = false " to be shown first , followed by the records where "watched = true ".
How can i achieve this
Upvotes: 0
Views: 24
Reputation: 4759
You would use ORDER BY
so you can do something like this:
SELECT * FROM TABLENAME ORDER BY WATCHED
then to switch it from true
or false
ordered first you can use DESC
or ASC
at the end. Your statement would be:
SELECT * FROM TABLENAME ORDER BY WATCHED ASC
DESC
keyword means descending so in your case it would show true
first
ASC
keyword means ascending which would show false
first
Upvotes: 1