there are five tables (personTb, addressTb,churchTb) each holds data pertinent to an individual; (personAddress,personChurch) each hold the primary key for the person table and corresponding table IE personAddress holds primary key for addressTb.
both snippets work, my question is; Is my join correctly formatted?
select
concat(personTb.p_fName,' ',personTb.p_mName,'. ',personTb.p_lName) AS Name,
concat(addressTb.a_street,' ',addressTb.a_box,' ',addressTb.a_city) AS Address,
concat(churchTb.c_name,' ',churchTb.c_city) AS Church
from personTb, addressTb, churchTb
where addressTb.a_ID=
(
select personAddress.a_ID
from personAddress
where personAddress.p_ID=personTb.p_ID
)
AND
churchTb.c_ID=
(
select personChurch.c_ID
from personChurch
where personChurch.p_ID=personTb.p_ID
);
/ next is my attempt at a join /
SELECT
concat(a.p_fName,' ',a.p_mName,'. ',a.p_lName) AS Name,
concat(b.a_street,' ',b.a_box,' ',b.a_city) AS Address,
concat(c.c_name,' ',c.c_city) AS Church
FROM personTb a
INNER JOIN addressTb b
ON b.a_ID=
(
SELECT d.a_ID
FROM personAddress d
WHERE d.p_ID=a.p_ID
)
INNER JOIN churchTb c
ON c.c_ID=
(
SELECT e.c_ID
FROM personChurch e
WHERE e.p_ID=a.p_ID
);