I am trying to find possible duplicate purchase orders in the system and am looking for a query that will return the number of occurences that duplicate vendor id's occur,
then I want to return a result set the takes that reflects the vendor's data. like purchase_ordernum, total_amount, create_date.
I have the first part done. What's the best way to pull the rest of the data?
COUNT ([VENDOR_ID]) AS NumOccurrences FROM [Database].[dbo].[PURCHASE_ORDER] GROUP BY [VENDOR_ID] HAVING (COUNT([VENDOR_ID]) > 1)
asked May 23, 2012 at 03:51 PM in Default
At the simplest level you could do:
GROUP BY [VENDOR_ID] HAVING (COUNT([VENDOR_ID]) > 1))
answered May 23, 2012 at 05:26 PM
Kev Riley ♦♦