Mysql更新查询是否可以在set下有case语句和select语句
我在更新查询的Mysql更新查询是否可以在set下有case语句和select语句,mysql,Mysql,我在更新查询的集合中遇到问题。我想查询另一个表,如果该表是空的,那么只需要一个新的时间。这是代码,但它不返回任何内容。没有得到任何错误 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:
集合中遇到问题。我想查询另一个表,如果该表是空的,那么只需要一个新的时间。这是代码,但它不返回任何内容。没有得到任何错误
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
看起来您缺少上面代码中的更新
更新表\u参考
设置分配列表
[何处条件]
[由……订购]
[限制行数]
这甚至不是有效的UPDATE
子句。你的更新在哪里???我看不出来UPDATE
子句以单词UPDATE
开头,而不是SET
。