View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dave k dave k is offline
external usenet poster
 
Posts: 21
Default SQL - list items that have duplicates

I can't seem to figure out how to list items that have duplicates. I can
list items and their related counts, but can't just list the items with
duplicates.

This SQL statement lists items and their counts
SELECT VENDID, COUNT(*) AS VENDIDCOUNT FROM VENDTABLE GROUP BY VENDID

but this one doesn't seem to work
SELECT VENDID FROM VENDTABLE WHERE VENDIDCOUNT 1 IN (SELECT COUNT(*) AS
VENDIDCOUNT FROM VENDTABLE GROUP BY VENDID)

Thanks for the help!
Dave