在进行大量搜索后,我无法找到所需的结果。我有一个包含以下数据的表tasktransit :
+---------------+--------+------------+-------------+-------------+------------+
| tasktransitid | taskid | activityid | newsequence | status | dependency |
+---------------+--------+------------+-------------+-------------+------------+
| 1 | RH001 | 1 | 1 | Not Started | |
| 2 | RH001 | 2 | 2 | Completed | |
| 3 | RH001 | 3 | 4 | Not Started | |
| 4 | RH001 | 4 | 3 | Not Started | |
| 5 | RH002 | 3 | 1 | Completed | NULL |
| 6 | RH002 | 4 | 2 | Not Started | |
| 7 | RH003 | 3 | 1 | Not Started | NULL |
| 8 | RH004 | 4 | 2 | Not Started | NULL |
+---------------+--------+------------+-------------+-------------+------------+
这里的newsequence对于一种taskid来说是独一无二的。
I want to get the the taskid where
activityid=4 AND
status="Not Completed" AND
status="Completed" of previous newsequence.
因此,使用上述类型的 sudo 代码,我想要一个具有以下值的结果
taskid | activityid
1. RH001 | 4
2. RH002 | 4
任何帮助都会得到帮助。