SQL Server select distinct latest values

后端 未结 2 2007
星月不相逢
星月不相逢 2021-02-15 00:10

I have a table that has a ton of rows (>10K). Most of the rows have duplicate role values associated with the username.

What I am tryi

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-15 00:39

    It seems like ISNULL would solve your problem, I use 1 here for simplicity but you could use -1 if that makes more sense for your usage.

    MAX(ISNULL(request_id, 1))
    

提交回复
热议问题