JOIN and LIKE

Started by kttover 23 years ago2 messagesgeneral
Jump to latest
#1ktt
kestutis98@yahoo.com

hello,

Could you provide me with some examples of using
JOIN and LIKE in the same sentence?
I woul like to join tables and search them for the
text pattern.

ktt

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

#2Holger Klawitter
lists@klawitter.de
In reply to: ktt (#1)
Re: JOIN and LIKE

Am Dienstag, 16. Juli 2002 09:10 schrieb ktt:

hello,

Could you provide me with some examples of using
JOIN and LIKE in the same sentence?
I woul like to join tables and search them for the
text pattern.

You can use LIKE just like ;-) any other operator.

SELECT
*
FROM
a JOIN b ON a.id = b.id
WHERE
a.name LIKE 'pattern%'
;

There is no problem with using LIKE even in the
ON part of a join (at least in 7.2.1).

SELECT
*
FROM
a JOIN b ON a.data LIKE b.pattern
;

The full power of joins unfold when using LEFT JOIN
and such. In this case you might even get the pattern
which do not have something to match.

SELECT
*
FROM
a RIGHT JOIN b ON a.data LIKE b.pattern
;

Mit freundlichen Gruß
Holger Klawitter
--
Holger Klawitter http://www.klawitter.de
lists@klawitter.de