MYSQL get the name from another table that is associated with the first table

Posted by Juan Gonzales on Stack Overflow See other posts from Stack Overflow or by Juan Gonzales
Published on 2012-06-24T21:12:16Z Indexed on 2012/06/24 21:15 UTC
Read the original article Hit count: 277

Filed under:

I can't figure out why this statement is not working

SELECT myChurches.id AS id, myChurches.church_name AS church_name 
FROM myChurches 
INNER JOIN church_staff 
ON church_staff.church_id=myChurches.id
WHERE church_staff.mem_id='$logOptions_id' 
ORDER BY myChurches.church_name 
ASC

Basically I need to find the person's that are staff members of a church from one table and want to get the 'name' of that church FROM the 'myChurches' table. Hopefully that makes sense. Thanks in advance

© Stack Overflow or respective owner

Related posts about mysql