A note to myself...
//Filter records only 1 row: HAVING count(1) = 1
SELECT OrderID FROM [Order Details] (NOLOCK) GROUP BY OrderID HAVING count(1) = 1
//Filter records more than one row: HAVING count(1) > 1
SELECT OrderID FROM [Order Details] (NOLOCK) GROUP BY OrderID HAVING count(1) > 1
Ref: http://www.w3resource.com/sql/aggregate-functions/count-having.php
沒有留言:
張貼留言