I have a Dossiers
table with a print_flag
column and i want set print_flag
=1 for multiple rows.
UPDATE dossiers SET print_flag = 1
WHERE id=1013997,id=1020799,id=1020800,id=1020800;
How should the SQL look like?
I have a Dossiers
table with a print_flag
column and i want set print_flag
=1 for multiple rows.
UPDATE dossiers SET print_flag = 1
WHERE id=1013997,id=1020799,id=1020800,id=1020800;
How should the SQL look like?
You should use the IN clause as it'll allow you to use multiple values for a single column.
UPDATE dossiers SET print_flag = 1
WHERE id IN(1013997, 1020799, 1020800);
You need IN
clause as:
UPDATE dossiers
SET print_flag = 1
WHERE id IN (1013997,1020799,1020800,1020800);
UPDATE dossiers
SET print_flag = 1
WHERE id IN(1013997,1020799,1020800,1020800);
Use the IN clause. (BTW, i dont think the double of 1020800 is necessary, so i've omitted it.)
UPDATE dossiers SET print_flag = 1
WHERE id IN(1013997, 1020799, 1020800);
If you are sure about the ids you are passing in the query are existed in table than you may try this one :
UPDATE dossiers SET print_flag = 1 WHERE id IN (1013997,1020799,1020800,1020800);