View Single Post
  #2 (permalink)  
Old 10-18-2006, 02:54 AM
Dimitar
 
Posts: n/a
Default SQL 92 answer. Re: How can I find fields that have a substring in common?

[sql]
select t0.s from t t0 , t t1 where position(t0.s in t1.s) <>0 group by t0.s having count(*) > 1
[/sql]
A quick answer based on the idea that you join a table with itself to produce a t^2 from which you select only those who have something in common. The grouping and the having clause are used to filter out rows produced by a row with itself.
Reply With Quote