|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 1:20 PM
Points: 143,
Visits: 489
|
|
Hello,
I can't wrap my head around what the below query does when it includes a having count(*) > 1 and used with the group by? Can someone please help me understand this?
SELECT RxNbr, RefillNo FROM dbo.POSRx AS pr WHERE DateFilledSK >= 20120901 AND Void = 0 GROUP BY RxNbr, RefillNo HAVING COUNT(*) > 1
Thanks,
Sean
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: 2 days ago @ 4:48 PM
Points: 834,
Visits: 5,836
|
|
It's looking for duplicates. It will only show rows where there is more than 1 instance of the combination of columns in the 'group by'.
And then again, I might be wrong ... David Webb
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 1:20 PM
Points: 143,
Visits: 489
|
|
|
|
|