I'm using SQLite in an Android application.
In all of my tables I have a default row with an index of 0 that holds default values for that table.
In most situations the default number for each field is 0 and that is the best number to use.
However, when I sort my data using an ORDER BY statement I want to have all of my zero value fields put at the end of the list as they're generally empty and using default information.
Excluding these fields in a where statement is unacceptable as I'm trying to sort information, not filter it.
Here's what I have so far:
select distinct item.name, epoch_date.epoch
from epoch_date, time
where (time.begin_date_id = epoch_date._id)
and (item.time_id = time._id)
order by epoch_date.epoch;
In my sandbox database, this returns something like:
"item 1", 0
"item 2", 0
"item 4", 0
.
.
.
"item 3", 1275350400
"item 42", 1275472800
"item 12", 1275472800
But what I want is:
"item 3", 1275350400
"item 42", 1275472800
"item 12", 1275476400
.
.
.
"item 1", 0
"item 2", 0
"item 4", 0