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 |
|
Bernard_za
Starting Member
6 Posts |
Posted - 2003-07-16 : 05:51:07
|
| I have a table with the following fields and dataPolicyID | RIID---------------123456789| 1-NPV100055555| 1-WOP123456789| 1-XOM123586784| 1-ROP123456789| 1-VPNThe table has many rows and I am looking for a easy way to find out which PolicyID has more than one RIID allocated to it. If the PolicyID only has one RIID it should not show.Please help! |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2003-07-16 : 06:05:51
|
| SELECT policyID, count(riid)FROM yourtablegroup by policyidhaving count (riid) > 1-------Moo. :) |
 |
|
|
Bernard_za
Starting Member
6 Posts |
Posted - 2003-07-16 : 06:15:19
|
| This provides a list of PolicyID's with more than one RIID but I need it to show only if the RIID is different to the other RIID for the same PolicyID |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2003-07-16 : 06:34:50
|
| SELECT policyID, count( distinct riid)FROM yourtablegroup by policyidhaving count ( distinct riid) > 1-------Moo. :) |
 |
|
|
|
|
|