If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to do LIKE matching in a.Name=b.Name

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-26-08, 05:32
cy163 cy163 is offline
Registered User
 
Join Date: Apr 2007
Posts: 127
How to do LIKE matching in a.Name=b.Name

Hello ALL,


I have a statement as follows
Code:
SELECT * FROM tb1, tb2 WHER tb1.Name = tb2.Name
I would like to do fuzzy matching on the name field. I need something like
Code:
SELECT * FROM tb1, tb2 WHER tb1.Name LIKE '%tb2.Name%'
Also, I tried with
Code:
SELECT * FROM tb1, tb2 WHER LOCATE(tb1.Name, tb2.Name)<>0
Reply With Quote
  #2 (permalink)  
Old 11-26-08, 05:46
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Try:
Code:
LIKE Concat('%', tb2.Name, '%')
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On