firemail
标题:
更新查询条件来自要更新表的sql语句
[打印本页]
作者:
java
时间:
2018-11-13 12:05
标题:
更新查询条件来自要更新表的sql语句
UPDATE user_calendar
SET
special_attention = 0
WHERE
id IN (SELECT
a.id
FROM
user_calendar a
WHERE
a.user_id = 4 AND a.status = 0 AND a.special_attention =0)
复制代码
上面不行
按下面写法
UPDATE user_calendar
SET
special_attention = 0
WHERE
id IN (SELECT
temp.id
FROM
(SELECT
a.id
FROM
user_calendar a
WHERE
a.user_id = 4 AND a.status = 0 AND a.special_attention =0) temp) 要这样写
复制代码
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3