Why can't indexed views have a MAX() aggregate?

后端 未结 4 633
轮回少年
轮回少年 2020-12-10 00:14

I have been trying out a few index views and am impressed but I nearly always need a max or a min as well and can not understand why it doesn\'t work with these, can anyone

4条回答
  •  借酒劲吻你
    2020-12-10 00:49

    if you just want to see things ordered without adding a sort by when you use a view I just add a column with and order by in it.

    id = row_number() over (order by col1, col2) 
    

提交回复
热议问题