There is an initial table (fruits):
ID | TITLE | COLOR | COUNT ___|_____________________________ 1 | Banana | Yellow | 0 2 | Lemon | Yellow | 0 3 | Apple | Green | 0 4 | Orange | Orange | 0 5 | Pear | Yellow | 0 How do I change the COUNT value when prompted:
"SELECT title FROM fruits WHERE color = 'Yellow' ORDER BY RANDOM() LIMIT 2"; Those. two randomly selected fruits must change by one:
ID | TITLE | COLOR | COUNT ___|_____________________________ 1 | Banana | Yellow | 1 2 | Lemon | Yellow | 0 3 | Apple | Green | 0 4 | Orange | Orange | 0 5 | Pear | Yellow | 1 It turned out to write the following:
"UPDATE fruits SET count = (count + 1) WHERE title IN (SELECT title FROM fruits WHERE color = 'Yellow' ORDER BY RANDOM() LIMIT 2)" But with this request, I can not work with the selected entries.
countvalue in the table should change, I will not display and use it - slippyk