mySQL inner join table IF needed -
hey have following query:
select ua.fname, ua.lname, ua.title, ua.accdate, ua.address1, ua.address2, ua.city, ua.state, ua.zip, ua.email, ua.phone, labcasenum, speccasenum, deadlinedate, casedetail, au.fname authname, au.lname, au.phone, au.email, au.role useraccount ua inner join usercase uc on ua.accnum = uc.userlink inner join authperson au on uc.casenum = au.usercase uc.casenum = 7903579800;
which works fine if there data in au table. however, no records return if there none in au table even though there's data in uc , ua tables had.
how can format query above ignore au table if there no data gathered?
did try using left join on table:
select ua.fname, ua.lname, ua.title, ua.accdate, ua.address1, ua.address2, ua.city, ua.state, ua.zip, ua.email, ua.phone, labcasenum, speccasenum, deadlinedate, casedetail, au.fname authname, au.lname, au.phone, au.email, au.role useraccount ua inner join usercase uc on ua.accnum = uc.userlink left join authperson au on uc.casenum = au.usercase uc.casenum = 7903579800;
this return rows other tables ua
, uc
, return null
au
rows if there not matching usercase
in table.
Comments
Post a Comment