Re: [sqlite] Automatic numbering

2018-07-07 Thread Cecil Westerhof
2018-07-07 14:57 GMT+02:00 Simon Slavin : > On 7 Jul 2018, at 12:04pm, Cecil Westerhof wrote: > > > ​I went for the following solution: > >UPDATE > ​​ > ​​ > selectRandom > >SETlastUsed= DATE('now', 'localtime') > >, lastUsedIdx = ( > >SELECT IFNULL(MAX(lastUsedId

Re: [sqlite] Automatic numbering

2018-07-07 Thread Simon Slavin
On 7 Jul 2018, at 12:04pm, Cecil Westerhof wrote: > ​I went for the following solution: >UPDATE selectRandom >SETlastUsed= DATE('now', 'localtime') >, lastUsedIdx = ( >SELECT IFNULL(MAX(lastUsedIdx), 0) >FROM selectRandom >WHERE lastUsed = DATE(

Re: [sqlite] Automatic numbering

2018-07-07 Thread Cecil Westerhof
2018-07-05 5:37 GMT+02:00 Simon Slavin : > On 5 Jul 2018, at 3:22am, Cecil Westerhof wrote: > > > I only want to store a date with a record. But it is possible that more > as > > one record will be inserted, so I want to use another field to use as an > > index. So that the first gets an one, the

Re: [sqlite] Automatic numbering

2018-07-05 Thread David Raymond
t * from foo; QUERY PLAN `--SCAN TABLE foo date|sequence|something1|something2|something3 2018-07-05|1|A|A|A 2018-07-05|2|B|B|B 2018-07-05|7|D|D|D 2018-07-05|8|E|E|E -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Cecil Westerho

Re: [sqlite] Automatic numbering

2018-07-04 Thread Cecil Westerhof
2018-07-05 5:37 GMT+02:00 Simon Slavin : > On 5 Jul 2018, at 3:22am, Cecil Westerhof wrote: > > > I only want to store a date with a record. But it is possible that more > as > > one record will be inserted, so I want to use another field to use as an > > index. So that the first gets an one, the

Re: [sqlite] Automatic numbering

2018-07-04 Thread Simon Slavin
On 5 Jul 2018, at 3:22am, Cecil Westerhof wrote: > I only want to store a date with a record. But it is possible that more as > one record will be inserted, so I want to use another field to use as an > index. So that the first gets an one, the second a two, etc. > Is this possible, or do I just

[sqlite] Automatic numbering

2018-07-04 Thread Cecil Westerhof
I only want to store a date with a record. But it is possible that more as one record will be inserted, so I want to use another field to use as an index. So that the first gets an one, the second a two, etc. Is this possible, or do I just have to check if there is already a date and fetch the high