mytable fld1 int primkey
fld2 varchar(20),
fld3 varchar(20)
From the definition of the above table, how do i do i modify my below query to only select the rows with duplicates in fld2. I know a groupby with a having count will display the duplicates for a given field, but i want my query to see all the fields and rows that are duplicates.
select fld1, fld2, fld3 from mytable
SELECT fld2,COUNT(*) FROM myTable GROUP BY Flt2 HAVING COUNT(*)>1
No comments:
Post a Comment