更新 oracle 后,下面的查询开始返回奇怪的结果,它应该返回带有一些值的列,但是在与null
查询进行一些调整后,发现如果我改变查询开始像以前一样工作。有什么建议吗?t.event_id = d.event_id
t.event_id = 125162
SELECT LEAST (
MAX (
d.event_step
- (CASE WHEN d.status IN (51, 52, 53) THEN 0 ELSE 2 END)),
3)
AS nextStep
FROM x_events_step d
WHERE d.event_id = 125162 AND d.state = 1
AND d.event_step_id >
NVL ( (SELECT MAX (t.event_step_id)
FROM x_events_step t
WHERE t.event_id = d.event_id AND t.state = 2),
0);