Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 06 Sep 2005 @ 20:01:00 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


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



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023