meekro - MySQL Left Join (using MeekroDB) -
this meekrodb exclusive issue, trying wrap head around left_join.
i have 2 tables: comp_checklis
t , comp_checklist_items
i want rows comp_checklist
user id matches , worked fine:
db::query("select * comp_checklist user_id = %i", $user_id );
now wand same query ( rows comp_checklist
user id matches ) , add comp_checklist_items rows checklist_id
matches in both tables (checklist_id
primary key in comp_checklist
table). used below false
db::query("select * comp_checklist user_id = %i left join comp_checklist_items on checklist_id = comp_checklist.checklist_id", $user_id );
join should come before where, , columns should have table name or error:
db::query("select * comp_checklist left join comp_checklist_items on comp_checklist_items.checklist_id = comp_checklist.checklist_id comp_checklist.user_id = %i ", $user_id );
Comments
Post a Comment