Skip to content

Commit 9f33495

Browse files
Update retrieving-first-instance-of-change-event-using-conditional_change_event.md
1 parent d067c45 commit 9f33495

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

retrieving-first-instance-of-change-event-using-conditional_change_event.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ This can be a very powerful function to use when analyzing events data or time-s
88
|:--:|
99
|We need to retrieve the first `status_date` by Support Engineer per Case Status change|
1010

11-
```
11+
```sql
1212
with support_cases as (
1313
select *
14-
, conditional_change_event (status || support_engineer) over (partition by case_number order by update_date asc) as dense_sequence
14+
, conditional_change_event (status || support_engineer)
15+
over (partition by case_number order by update_date asc) as dense_sequence
1516
from support_case
1617
)
1718
select * from support_cases
1819
qualify row_number() over (partition by case_number, dense_sequence order by update_date) = 1;
1920
```
2021

22+
|![Screen Shot 2024-12-05 at 8 12 20 AM](https://github.com/user-attachments/assets/fc8661f4-4bea-4a15-8bea-5cdcc65a67ea)|
23+
|:--:|
24+
|First `status_date` by Support Engineer per Case Status chang|
2125

0 commit comments

Comments
 (0)