MySQL Forums
Forum List  »  MySQL Query Browser

JOIN ON using string and wildcard
Posted by: Örjan Toräng
Date: March 27, 2011 04:07AM

Found others looking for the same, how to use wildcard in a JOIN ON using a string reference:

This is how I soleved it with wildcard:
****************************************************************
SELECT acl.* , node.type FROM acl
LEFT JOIN node ON ( acl.name LIKE concat( '%', node.nid ) )
WHERE 1
****************************************************************

This is how I soleved it with fixed value:
****************************************************************
SELECT acl.* , node.type FROM acl
LEFT JOIN node ON ( acl.name LIKE concat( 'view_', node.nid ) )
WHERE 1
****************************************************************


Refering to:
http://forums.mysql.com/read.php?108,396442,396442

Options: ReplyQuote


Subject
Written By
Posted
JOIN ON using string and wildcard
March 27, 2011 04:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.