2018-07-12 9:30 GMT+02:00 Cecil Westerhof <cldwester...@gmail.com>:

> A few tables have a not completely apt named column totalUsed.
>
> It is used to see which records are more used as other records and give
> the less used records a bigger chance of being selected. When the numbers
> become high I do something like:
> UPDATE tips
> SET totalUsed = totalUsed - (SELECT MIN(totalUsed) FROM tips) + 1
>
> I am not quit happy with this. Would it be better to split it in two
> queries and feed the result of the first to the second?
>

​By the way, I wanted to use:
UPDATE quotes
SET totalUsed = totalUsed - MIN(totalUsed) + 1

but that gives:

Error: misuse of aggregate function MIN()

-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to