On 1/4/19 6:30 AM, Cecil Westerhof wrote:
> I have the following query:
> SELECT MIN(totalUsed) - 1
> FROM   quotes
> WHERE  totalUsed <> 'notUsed'
>
> What I want is that when the SELECT returns a positive value every record
> where totalUsed <> 'notUsed' is lowered with the returned value. Is easy to
> accomplish in programming code, but I was wondering if this could be done
> with a SQL statement.
>
Look at the UPDATE query:

UPDATE quotes SET totalUsed = totalUsed - 1 WHERE totalUsed <> 'notUsed';


I will note that this database is obviously using SQLite's variation
from SQL of mixed type columns, as it appears that totalUsed is likely a
column that is normally numeric, but sometimes a string.

-- 
Richard Damon

_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to