Hey everyone,
I have been to this site countless times reading the forums getting my questions answered and it is much appreciated.
One question I have is about LEFT JOINS.
I have a roster for a module in PHPNuke I did called MILPACS. The development site is located here.
http://milpacs.3rd-infantry-division.net/index.php
Here is the roster itself.
http://milpacs.3rd-infantry-division.net/modules.php?name=MILPACS&file=roster
A members must be assigned to a unit to appear in the roster, but they need not be assigned a weapon_id or a rank_id. I can accomplish this with LEFT JOINS but I have four different tables with this query.
milpacs_members
milpacs_weapons
milpacs_units
milpacs_ranks
Here is my code:
$sql = "SELECT * FROM " . $prefix . "_milpacs_members mm
LEFT JOIN " . $prefix . "_milpacs_weapons mw,
" . $prefix . "_milpacs_units mu,
" . $prefix . "_milpacs_ranks mr
ON mm.unit_id = mu.unit_id
AND mm.weapon_id = mw.weapon_id
AND mm.rank_id = mr.rank_id
AND mm.status IN ('Active','LOA')
ORDER BY mu.unit_order, mm.subunit_id, mr.rank_order, mm.promotion_dt asc";
Thanks in advance.