Mysql multiple tables left join last table -



Mysql multiple tables left join last table -

i have checked several threads on here , cannot find reply question.... trying mysql query multiple tables , left bring together lastly table. not left bring together , gives me no results when include it. help appreciated :)

(i using joomla)

query = "select distinct u.id uid, concat(u.first_name,' ',u.last_name) name1, u.grad grad, u.opt_out opt_out #__bl_teams t, #__bl_regions r, #__users u left bring together #__bl_paid pd on pd.u_id = u.id u.team_id = t.id , u.team_id != '' , u.s_id = $sid , ((t.id = $tid)or($tid=0)) , (t.id in ($teamsfull)) , ( (t.id in(".$tc_teams."))or(".$tc_id." = 0)) , ((r.id = ".$mid.")or(".$mid." = 0)) , ((r.s_id = ".$sid.")or(".$mid." = 0)) , ( (find_in_set(t.id,r.teams) )or(".$mid." = 0) ) , u.id not in($paidrows) , u.id not in ($rsrows) grouping u.id"; $db->setquery($query, $pagenav->limitstart, $pagenav->limit); $rows50 = $db->loadobjectlist();

you mixing old-style joins , new style joins. problem. table aliases aren't recognized throughout from statement, way expect them be. buried in documentation warning:

however, precedence of comma operator less of inner join, cross join, left join, , on. if mix comma joins other bring together types when there bring together condition, error of form unknown column 'col_name' in 'on clause' may occur. info dealing problem given later in section.

simple rule: never utilize commas in from clause.

so, rewrite query using explicit joins , prepare problem.

mysql

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -