$sql = "SELECT m.id_m As id,m.name_m As name,a.id_moo As moo,a.address_m As addmu,a.tel_m As tel FROM member m INNER JOIN address a ON m.id_m = a.id_m";
ลองเอา Where ออก เนื่องจากมีการใช้ ON เป็นเงื่อนไขของหาร Join
ใช้ m เป็นชื่อย่อของ member
ใช้ a เป็นชื่อย่อของ address
เพื่อให้การเขียนโค๊ดสั้นลง และดูง่ายขึ้น
$sql = "SELECT m.id_m As id,m.name_m As name,a.id_moo As moo,a.address_m As addmu,a.tel_m As tel
w.id_m As id,w.type_w As type,w.income_w As comment
FROM member m INNER JOIN address a and welfare w ON m.id_m = a.id_m and m.id_m =w.id_m";
$sql = "SELECT m.id_m As id,m.name_m As name,a.id_moo As moo,a.address_m As addmu,a.tel_m As tel
w.id_m As id,w.type_w As type,w.income_w As comment
FROM member m
INNER JOIN address a ON a.id_m = m.id_m
INNER JOIN welfare w ON w.id_m = m.id_m ";