Select all those Name From table whose count is 3 in SQL Server
select t.name from (select name,count(name) as namecount from table1 group by name) t where t.namecount=3
table1
Name (column)
a
a
a
a
b
b
b
v
v
v
g
hg
g
g
k
k
o/p
Name
a
b
v
g
select t.name from (select name,count(name) as namecount from table1 group by name) t where t.namecount=3
table1
Name (column)
a
a
a
a
b
b
b
v
v
v
g
hg
g
g
k
k
o/p
Name
a
b
v
g
No comments:
Post a Comment