如何在单个查询中更新多行值

问题描述 投票:0回答:1
Hi i have a one table called as title its have id and datefield ,now id is have da but date value is Present 0000-00-00 00:00:00.
Now i want to update (2019-11-01 00:00:00) muliple rows based on id

我的礼物表

enter image description here

我想要结果

enter image description here

mysql
1个回答
1
投票

您似乎想要基于jtm_id的条件更新:

update title 
set jtm_cdatetime = case jtm_id
    when 2 then '2017-10-10'
    when 3 then '2017-10-11'
    when 4 then '2017-10-10'
    when 5 then '2017-10-02'
    when 7 then '2017-10-12'
end
where jtm_cdatetime is null
© www.soinside.com 2019 - 2024. All rights reserved.