Picking rows with partitions

I’m constantly faced with situations with data in Salesforce Marketing Cloud where I need to select or identify rows based on some ordered criteria. The row_number() over (partition by x order by y) as ranking is my go-to method.

This particular query finds a random row for each bounce category in the _bounce data view:

Recently, found this shorter method using top 1 with ties:

Credit @TheGameiswar


(Visited 2,898 times, 1 visits today)
guest
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments