List:General Discussion« Previous MessageNext Message »
From:Chris Sansom Date:April 11 2006 2:58pm
Subject:Re: Problem with 'or' in 'where' clause? (longish)
View as plain text  
At 16:37 +0200 11/4/06, Barry wrote:
>select [what you want]
>  from t1
>  LEFT JOIN t2 ON t2.id = t1.id
>  LEFT JOIN t3 ON t3.id = t1.id
>  LEFT JOIN t4 ON t4.id = t1.id
>  LEFT JOIN t5 ON t5.id = t1.id
>  LEFT JOIN t6 ON t6.id = t1.id
>  where
>     t2.text like '%search_term%' OR t3.text like '%search_term%' OR
>     t4.text like '%search_term%' OR t5.text like '%search_term%' OR
>     t6.text like '%search_term%' ORDER BY t1.id ASC;

That's the one! Thanks so much, Barry - looks like I've a lot still 
to learn. :-) I had a sneaking feeling the answer might lie in left 
join, but nowhere in my otherwise excellent MySQL book (it's the one 
for version 3 by Paul DuBois), nor in any online docs I could find, 
could I see how to combine more than one.

This works like a charm anyway - thanks again. Not only that, but I 
/think/ I understand it. ;-)

-- 
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

What contemptible scoundrel has stolen the cork to my lunch?
    -- W.C. Fields
Thread
Problem with 'or' in 'where' clause? (longish)Chris Sansom11 Apr
  • Re: Problem with 'or' in 'where' clause? (longish)mos11 Apr
    • Re: Problem with 'or' in 'where' clause? (longish)Chris Sansom11 Apr
  • Re: Problem with 'or' in 'where' clause? (longish)Barry11 Apr
    • Re: Problem with 'or' in 'where' clause? (longish)Chris Sansom11 Apr
      • Re: Problem with 'or' in 'where' clause? (longish)Barry11 Apr
        • Re: Problem with 'or' in 'where' clause? (longish)Chris Sansom11 Apr
          • Re: Problem with 'or' in 'where' clause? (longish)Barry11 Apr
            • Re: Problem with 'or' in 'where' clause? (longish)Barry11 Apr
            • Re: Problem with 'or' in 'where' clause? (longish)Chris Sansom11 Apr
  • Re: Problem with 'or' in 'where' clause? (longish)Barry11 Apr