have this table OCC
COD.............NAME
001.............TOM
001.............SAM
002.............CAT
003.............DOG
003.............SAM
003.............TOM
004.............JACK
005.............TOM
005.............SAM
........................
........................
........................
........................
I'd like to get just cod with more name:
I tried this
SELECT COUNT(NAME) TOT, COD
FROM OCC
GROUP BY COD
HAVING COUNT(NAME) > 1
OK, I get this:
TOT..........COD
2............001
3............003
2............005
but I'd like to get also the records.
For example I want this (only the records with more name):
COD.............NAME
001.............TOM
001.............SAM
003.............DOG
003.............SAM
003.............TOM
005.............TOM
005.............SAM
How can I write this query??
Thanks


Reply With Quote

Bookmarks