Question: Okay it has been quite some time since I have used SQL Server very intensively for writing queries.

There has to be some gotcha that I am missing.

As per my understanding the following two queries should return the same number of duplicate records

```
SELECT COUNT(INVNO)
     , INVNO
FROM INVOICE
GROUP BY INVNO
HAVING COUNT(INVNO) > 1
ORDER BY INVNO

SELECT DISTINCT invno
FROM INVOICE
ORDER BY INVNO

```

There are no null values in INVNO

Where could I be possible going wrong?

Answer: 
Those queries will not return same results. First one will only give you INVNO values that have duplicates, second will give all unique INVNO values, even if they appear only once in entire table.
the group by query will filter our all the single invoices while the distinct will simply pick one from every invoice. First query is a subset of the second