我在 SQLite 3 数据库中有以下 SQL 查询
UPDATE Events
SET location = CASE
WHEN identifier = (SELECT id FROM users_db.exerciseLists WHERE patientId = ? AND complete = 1)
THEN 'yellow'
WHEN identifier = ?
THEN 'green'
WHEN date_start < datetime('now')
THEN 'red'
WHEN date_start > datetime('now')
THEN 'blue'
ELSE 'green'
END,
type = CASE
WHEN identifier = ?
THEN 'yes'
ELSE 'no'
END
子查询
(SELECT id FROM users_db.exerciseLists WHERE patientId = ? AND complete = 1)
返回多个结果,但上述案例查询仅使用第一个返回的结果。
我究竟做错了什么?
谢谢