zqifa的博客

我不管,反正我最萌~

sql update set使用case when语句

1、

update TD_XXX
set
djyzmdm=null,
djyzmsj=null,
DLCS= case when DLCS is null then 1 else DLCS+1 end
where djsj='xxx'

2、

update `TD_XXX`
set
`datetime` = 1434567890,
`status` = case `id` when 12 Then 1 when 13 Then 2 when 14 Then 1 end
where `id` in (12,13,14)

作者:zqifa

出处:https://www.l1mn.com

原文地址:https://www.l1mn.com/p/1caiq2.html

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。

分类:sql
标签:sql

公告

昵称:zqifa

站龄: 4年2个月

博客持续完善ing,敬请期待...

打滚求打赏(๑ ̄ ̫  ̄๑)

此处弱弱求打赏~~万一有好心人呢~~

支付宝酱

支付宝赞助

微信酱

微信赞助

随笔分类

php(110)

linux(63)

python(44)

web前端(39)

js(35)

服务器(33)

mysql(30)

html(24)

docker(23)

windows(22)

centos(22)

django(20)

前端设计(18)

git(16)

常用软件(14)

数据库(14)

算法(14)

字符编码(13)

编程进阶(13)

笔记(12)

更多

我的标签

php(106)

linux(47)

python(45)

js(34)

mysql(30)

centos(28)

web前端(23)

docker(22)

windows(22)

django(20)

更多

相册

Copyright © zqifa 联系方式:z___qf@163.com