Window functions to count distinct records

前端 未结 3 489
没有蜡笔的小新
没有蜡笔的小新 2020-12-23 15:08

The query below is based on a complicated view and the view works as I want it to (I\'m not going to include the view because I don\'t think it will help with the question a

3条回答
  •  旧时难觅i
    2020-12-23 15:58

    Why would something like this not work?

    SELECT 
       IDCol_1
      ,IDCol_2
      ,Count(*) Over(Partition By IDCol_1, IDCol_2 order by IDCol_1) as numDistinct
    FROM Table_1
    

提交回复
热议问题