Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Updating column in MySql

I am trying to update column for three rows in sql. However when I run following query, only one row is affected. Can someone help me to see where I am making a mistake? Thank you!

update some_table
set date_updated = case some_id
when '7791'   then '2021-10-08 06:59:05'
when '1555'   then '2021-08-26 05:30:54'
when '363201' then '2021-08-31 05:01:45'
end
where some_id = ('7791, 1555, 363201') 
and date_updated between '2021-11-01' and '2021-11-03';

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You missed IN Clause

       where some_id in ('7791' ,'1555' , '363201') 
      and date_updated between '2021-11-01' and '2021-11-03';
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading