Thursday, 7 April 2016

SQL Select count greater then 3

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

No comments:

Post a Comment

SQL Table : Change Row As Column and Group Them... ( Setting column values as column names in the SQL query result )

Setting column values as column names in the SQL query result Problem Statement : id col1 col2 1 Pending 30 1 Resolved 48 ...