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.
Author |
Topic |
tpayne
Starting Member
18 Posts |
Posted - 2009-01-22 : 14:11:37
|
I have a table called PMAppraisals. PMAppraisalID is the key. Another field is PMUser. I want to return a list of all PMAppraisalIDs that have a count(PMUser) >1. Could you help?thanks. |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-01-22 : 14:51:20
|
If PMAppraisalID is the key (each row has unique value) then how could any PMAppraisalID have more than one PMUser?Be One with the OptimizerTG |
|
|
tpayne
Starting Member
18 Posts |
Posted - 2009-01-22 : 15:07:37
|
There is more than one record. PMAppraisalID = 200 PMUser = 282PMAppraisalID = 201 PMUser = 282sorry for the confusion.thanks. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-01-22 : 15:30:10
|
quote: I want to return a list of all PMAppraisalIDs that have a count(PMUser) >1
so you mean you want a list of [PMUser]s that have a count(PMAppraisalID) > 1, right?Be One with the OptimizerTG |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-01-22 : 15:33:19
|
[code]select PMUser, count(*) [PMAppraisalID_Count]from PMAppraisalsgroup by PMUserhaving count(*) > 1[/code]Be One with the OptimizerTG |
|
|
tpayne
Starting Member
18 Posts |
Posted - 2009-01-22 : 15:43:18
|
That works great. Thanks. I guess I was thinking backwards. |
|
|
|
|
|