Home » RDBMS Server » Server Administration » selecting potentially duplicate values
selecting potentially duplicate values [message #371801] Thu, 07 December 2000 13:45 Go to next message
Jerry
Messages: 21
Registered: December 1999
Junior Member
how do i do this? specifically, say a field is potentially a duplicate if the first 10 characters are the same. how do i set up the sql query to accomadate this? thanks!
Re: selecting potentially duplicate values [message #371813 is a reply to message #371801] Sat, 09 December 2000 22:08 Go to previous message
SQL_Tuner
Messages: 8
Registered: November 2000
Junior Member
select b1.blah, b2.blah
from blah_table b1, blah_table b2
where substr (upper (b1.blah), 1, 10) = substr (upper (b2.blah), 1, 10)
/

This would be one approach. This will be pretty slow if the table is large, tho. I am assuming that field <blah> is varchar2 and is the column you're searching for possible duplicates. If case is not a concern, you can remove the upper.

Regards,
ST
Previous Topic: What's wrong with the insert statement in a trigger?
Next Topic: Re: What's wrong with the insert statement in a trigger?
Goto Forum:
  


Current Time: Sun Dec 22 19:33:31 CST 2024