| Archives of the TeradataForumMessage Posted: Tue, 06 Sep 2005 @ 20:01:00 GMT
 
 
  
| Subj: |  | Re: Using "Like" and sub queries |  |  |  | From: |  | Dieter Noeth |  
 Anomy.Anom wrote: |  | I have a list of names from one table. What I want to do is to find any name that are similar to my first list in a second table. |  | 
 
 
 |  | I thought I could you a "Like"statement and a sub query but I was wrong. |  | 
 
 
 Of course you can: 
     select *
     from second_tab
     where second_col like any
        (select '%' || first_col || '%'
         from first_table)
 The result is similar to: 
     select *
     from second_tab join first_tab
     on second_col like '%' || first_col || '%'
 But maybe you have to add a DISTINCT. 
 Dieter 
 
 |