Oracle SQL - Return 已修改记录,加入时出现排序问题

Oracle SQL - Return modified records, problem with ordering when joining

我需要 return 行 child p_id(parent 是 p_id = 10 和 child = 20) 已更改。

我在 link 中使用了类似下面的东西,但它的顺序不正确,所以我得到了错误的结果。用例子解释会更容易:

此处需要所有数据和查询:db<>fiddle

正如您在结果中看到的,child 和 parent 行的顺序是混合的(例如,第一行:CHILD_DATE_FROM = 03/05/2022 和 PARENT_DATE_FROM = 08/05/2022(也应该是 03/05/2022))

为了澄清(因为我无法更好地解释)这个数据,我需要 return 结果如下(因为只有这些行发生了变化)

| pl_id | l_id  | date_from  | date_to          |
| ----- | ----- | ---------- | ---------------- |
| 20    | 313   | 10/05/2022 | 10/05/2022 18:21 |
| 20    | 316   | 11/05/2022 | 13/05/2022 04:22 |
| 20    | 316   | 15/05/2022 | 17/05/2022       |

感谢帮助

我不确定如何判断记录是否已更改但看起来像那样?

select distinct c.*
from child_gtt c, parent_gtt p
where p.l_id = c.l_id 
and not exists (
  select 1 
  from parent_gtt x 
  where c.l_id = x.l_id 
  and c.date_from = x.date_from 
  and c.date_to = x.date_to);

db<>fiddle