SQLite Forum

Getting rid of double DATE()
Login
One presumes you mean something like:

```
update selectRandom
   set lastUsed = now, 
       lastUsedIdx = (
                      select max(max(lastUsedIdx), 0) + 1
                        from selectRandom
                       where lastUsed == now
                     ) 
  from (
        select date('now', 'localtime') as now
       ) 
  where description == :teaToBrew;
```

which would eliminate having to write and execute the date function twice, any concern about the values being different during a single step being already irrelevant.