I am trying to select the first row of each group. Eg: below table I would want to keep product for www/edf/ and cate for www/abc/.
I have tried multiple ways, eg: ROW_NUMBER() OVER(PARTITION BY [...]) but somehow not getting expected outputs. The challenge for me here is that category does not have numbers as values, otherwise I can filter it down using max or min.
SELECT landing_page, ROW_NUMBER OVER ( PARTITION BY landing_page ORDER BY Page_Type DESC) AS ROW_NUM
from `xxxx.TEST.draft`
However I got this error: OVER keyword must follow a function call
Appreciate any help!
Landing_page | Page_type |
---|---|
www/edf/ | product |
www/edf/ | home |
www/abc/ | cate |
www/abc/ | home |