mysql update query是否可以在set下有case语句和select语句

ezykj2lf  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(279)

我的电脑有问题 SET 更新查询的。我想查询另一个表,如果该表是空的,那么在一个新的时间。这是代码,但它不返回任何内容。没有任何错误。

SET 
sched.Start= case when  (SELECT employee from sched where Day=Days and shift='Pm' and store = Stores and job='Driver') is null then '2018-01-01 16:00:00' else '2018-01-01 17:00:00' end

如果我在单独的查询中运行select,它会工作吗?

select  case when (SELECT employee from sched where Day='Thu' and shift='Pm' and store = 2284 and job='Pm Bread') is null then '2018-01-01 16:00:00' else '2018-01-01 17:00:00' end
qjp7pelc

qjp7pelc1#

您似乎缺少上面代码中的更新
更新表\u引用集分配\u列表[其中\u条件][排序依据…][限制行\u计数]
https://dev.mysql.com/doc/refman/8.0/en/update.html

相关问题