List:General Discussion« Previous MessageNext Message »
From:Philippe Poelvoorde Date:April 25 2006 4:15pm
Subject:Re: Stumped again by joins
View as plain text  
2006/4/25, Chris Sansom <chris@stripped>:
> At 15:56 +0200 25/4/06, Barry wrote:
> >And you don't see any misdone queries when you echo them, right?
> >Hope you checked that.
>
> Hi Barry
>
> I was wrong about its being a PHP issue: it's
> definitely a MySQL error. I realised I hadn't
> handled the error in such a way that I could see
> what it was, but now I have, so...
>
> The full query, in all its hideousness (but
> prettied up a bit in the formatting :-) ) is:
>
> ----------
>
> select count(distinct uid) as c
>
> from aptg_guides_restricted as r, aptg_guides as g
>
> left join guides_biography as b on b.guide_id = r.uid
> left join guides_interests as i on i.guide_id = r.uid
> left join guides_tours as t on t.guide_id = r.uid
> left join guides_walks as w on w.guide_id = r.uid
> left join guides_lectures as l on l.guide_id = r.uid
>
> where g.guide_uid = r.uid and show_on_web = '1' and
> (b.biography like '%london%' or i.interests like
> '%london%' or t.tours like '%london%' or w.walks
> like '%london%' or l.lectures like '%london%')
>
> ----------
>
> and the error I get back is:
> Unknown column 'r.uid' in 'on clause'
>

in 5.0.12 comma precedence was changed :
http://dev.mysql.com/doc/refman/5.0/en/news-5-0-12.html
so try with parenthesis, your implicit join and left join should then
works correctly.
Thread
Stumped again by joinsChris Sansom25 Apr
  • Re: Stumped again by joinsBarry25 Apr
    • Re: Stumped again by joinsChris Sansom25 Apr
    • Re: Stumped again by joinsChris Sansom25 Apr
      • Re: Stumped again by joinsgerald_clark25 Apr
        • Re: Stumped again by joinsChris Sansom25 Apr
      • Re: Stumped again by joinsPeter Brawley25 Apr
Re: Stumped again by joinsPhilippe Poelvoorde25 Apr