Friday, October 24, 2014

How to count same record in a table


SELECT *
FROM Table t
WHERE EXISTS (SELECT 1
FROM table
WHERE name = t.name
GROUP BY name
HAVING COUNT(*) > 1)

if you want names with counts alone use



SELECT Name,COUNT(*)
FROM table
GROUP BY Name
HAVING COUNT(*) >=2





Please Mark This As Answer if it solved your issue Please Mark This As Helpful if it helps to solve your issue Visakh ---------------------------- http://ift.tt/1tQfVTd http://ift.tt/19nLNVq http://ift.tt/1iEAj0c




No comments:

Post a Comment