View previous topic :: View next topic |
Author |
Message |
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Sat Apr 25, 2009 1:31 pm Post subject: duplicate value in column ? |
|
|
Our database has a column called 'policy_number' and a column
called 'veh_identification_number'....
We found out recently that a there are a lot of 'policy_number's that have duplicate 'veh_identication_number's (vehicle was mistakenly added to a policy twice)
Is there a way to identify all of the 'policies' for which this situation exists ?
policy_number veh_identifcation_number
1111111111 1FASP15J2TW127478 (duplicate)
1111111111 JT2AL32W8F0153774
1111111111 1FASP15J2TW127478 (duplicate)
2222222222 2GTEK19R0V1516247 (duplicate)
2222222222 2GTEK19R0V1516247 (duplicate)
2222222222 1N6HD16Y4KC341829
2222222222 A61J4FJ78L4KL562574
Thanks for any help..... |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Sat Apr 25, 2009 2:07 pm Post subject: |
|
|
tcurrier,
Untested sql
Code: |
SELECT POLICY_NUMBER
,VEH_ID_NUMBER
FROM table
GROUP BY POLICY_NUMBER
,VEH_ID_NUMBER
HAVING COUNT(*) > 1
|
Kolusu |
|
Back to top |
|
 |
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Sat Apr 25, 2009 4:48 pm Post subject: |
|
|
Thanks, Kolusu
Works great .... |
|
Back to top |
|
 |
|
|