I have this table and I would like to extract, by partition of split, the rows that have a part P1 in their PART column and have a row of PART='P2' in the day before.
SPLIT PART DATE
--------------------------
S1 P1 21/09/2022
S1 P2 20/09/2022
S1 P1 19/09/2022
S2 P1 21/09/2022
S2 P2 19/09/2022
S2 P1 19/09/2022
Expected output:
SPLIT PART DATE OUTPUT
----------------------------------
S1 P1 21/09/2022 X
S1 P2 20/09/2022 NULL
S1 P1 19/09/2022 NULL
S2 P1 21/09/2022 NULL
S2 P2 19/09/2022 NULL
S2 P1 19/09/2022 NULL