Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql Server 2008 - Select Field By its Count>2?

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2012-03-03 : 07:53:44
I have a table called table1. Abd the following manner the datas are available in its.

Field1          Field2
Programmer name1
Accountant name2
Accountant name3
store keeper name4
Programmer name5

From the above data I want to select Field1, which rows are having the count, more than 1. ie, the foolowing will be the output.

Programmer
Accountant

My Query :
=========

Select Field1 from MyTable where count(Field1)>1??????


Thanks


Paramu @ PARANTHAMAN

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-03 : 08:30:31
[code]
select Field1
from MyTable
group by Field1
having count(*) > 1
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2012-03-03 : 09:24:08
Thankyou khtan...

Paramu @ PARANTHAMAN
Go to Top of Page
   

- Advertisement -