If the table shows like below.
Number Name
1 A
2 A
3 B
4 C
5 D
So for the example, I want to get the A. Should I use join here?
If the table shows like below.
Number Name
1 A
2 A
3 B
4 C
5 D
So for the example, I want to get the A. Should I use join here?
You can use group by simply to get the same.
Select Name from [User] group by Name having COUNT(Name ) > 1
Try this:
SELECT * FROM (
SELECT Name,COUNT(*) AS[sum]
FROM[yourtable]
GROUP BY Name
) X
WHERE X.[sum] > 1
Try this code,
SELECT DISTINCT names
It will show unique value of table has more than a value.
Hope this help !
You can use group by and having to get your required result. You can use also a count to see the how many times same name there SELECT COUNT(name) AS total,name FROM tablename GROUP BY name HAVING COUNT(name) >2
you can use inner join
SELECT a.* FROM tbname AS a
INNER JOIN (
SELECT NAME FROM tbname GROUP BY NAME
HAVING COUNT(NAME)>1
) AS b ON a.name=b.name