On 15 Oct 2016, at 11:43pm, Richard Damon <rich...@damon-family.org> wrote:
> My thought is that if the first level of sort IS by Date-Time, and then by
> some other condition, then the real solution is to use an ORDER BY clause on
> the Date-Time field and then some other field to implement the duplicate
> value ordering (and likely have a covering index so this ORDER BY is
> efficient). This extra field doesn't need to be globally unique, just unique
> within a given value of Date-Time, so the practical issues in processing the
> primary key are greatly reduced (at minimum, if you need to renumber records,
> there are a lot less that need to be renumbered).
Nice summary above that.
The real question is why the OP wants this strange ordering. The standard sort
of search on this table would be like this:
SELECT * FROM MyTable ORDER BY Date, ID
Nothing special has to be done for this to do what I think the OP wanted in the
first place. New insertions will have ID's greater than the existing ones.
It'll just work.
In checking field names I just noticed this:
Just to remind the OP that this is a string of text. SQLite doesn't have a
date/time type. Those strings will not be sorted into date/time order. To
make that happen you'd need to use a format more like
sqlite-users mailing list