I have the following data
app | people | login |
---|---|---|
slack | Jenny | 2019-01-01 |
slack | Jenny | 2020-01-01 |
slack | Jenny | 2021-01-01 |
slack | Yang | 2020-06-01 |
slack | Yang | 2021-06-01 |
For each group app and user, I need to get the latest login date. I tried to use a window function, but could not get the result of what I am expecting:
SELECT app, people, LAST_VALUE(login) OVER (PARTITION BY app, people ORDER BY login)
FROM xxxxx
Any suggestions?