How to get this result in oracle database?
-
I don't know how to write this PL/SQL in oracle, thanks for your advice.
Because the amount of data in the table is large, it is not suitable to find the max PDate and then compare it from the source table.Table data:
Process PDate Status
100 2022/05/21 19:58:03 0
100 2022/05/22 07:01:00 0
100 2022/05/22 13:01:10 1
101 2022/05/22 08:23:39 0
101 2022/05/22 10:17:39 0
101 2022/05/22 17:49:39 1
102 2022/05/22 13:14:48 0Requirement: Get the status of the last record of different processes on 2022/05/22
Select result:
Process PDate Status
100 2022/05/22 13:01:10 1
101 2022/05/22 17:49:39 1
102 2022/05/22 13:14:48 0 -
I don't know how to write this PL/SQL in oracle, thanks for your advice.
Because the amount of data in the table is large, it is not suitable to find the max PDate and then compare it from the source table.Table data:
Process PDate Status
100 2022/05/21 19:58:03 0
100 2022/05/22 07:01:00 0
100 2022/05/22 13:01:10 1
101 2022/05/22 08:23:39 0
101 2022/05/22 10:17:39 0
101 2022/05/22 17:49:39 1
102 2022/05/22 13:14:48 0Requirement: Get the status of the last record of different processes on 2022/05/22
Select result:
Process PDate Status
100 2022/05/22 13:01:10 1
101 2022/05/22 17:49:39 1
102 2022/05/22 13:14:48 0First filter by PDate = datevariable, order by PDate Descending. Select the top 1 record.
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP