Sql Server Count if
Posted on 2014-08-29
I have an EXCEL 2010 spreadsheet that contains a column of ID numbers. There are over 300,000 rows; there are duplicates. I have a formula in a helper cell that count the occurances of an within the range--if the count is 1, then the helper cell value is 1, if not 1, then the helper cell value is zero( =IF(COUNTIFS(D$1:D16019,D16019)=1,1,0). Then I can count the helper cells with the value of 1.
The problem is that this crashes excel once the row count gets over 200K. Can this be done with a simple SQL query?