mysql update 加if_MySQL IF语句在UPDATE语句

1
2
3
UPDATE the tablerow with id=333, SET publish=''Y'' IF password=''xxx''
 
update yourtablename set publish=''Y'' where id=333 and password=''xxx'';
1
2
3
4
update driver_online
set vRemainCapacity= case when (vRemainCapacity>0) and ((vRemainCapacity-0.5) >0) then vRemainCapacity-0.5  else 0 end
 
where driverId = 'DR120161118100001
1
2
3
4
5
6
7
8
UPDATE user p 
JOIN user_roles ur
ON p.id = ur.user_id 
SET
ur.end_date = IF (ur.end_date IS NULL, NOW(), ur.end_date),
p.end_date = NOW(),
p.reason = "Retired"
WHERE p.id = 5

 

posted @   锐洋智能  阅读(3692)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 分享4款.NET开源、免费、实用的商城系统
· 解决跨域问题的这6种方案,真香!
· 5. Nginx 负载均衡配置案例(附有详细截图说明++)
· Windows 提权-UAC 绕过
历史上的今天:
2013-07-29 使用sun.misc.BASE64Decoder出错解决方案
点击右上角即可分享
微信分享提示