多表联合查询 实例

SELECT am.`account_id` , am.`related_id` , am.`dept_id` , am.`staff_id` , am.`inout_date` , am.`summary` , am.`ought_money` , am.`derate_money` , am.`inout_money` , am.`haved_money` , am.`handlestaff_id` , am.`note` , si.`staff_id` , si.`name` , ri.`related_id` , ri.`related_name` 

FROM`account_money`AS am

LEFTJOIN staffinfo AS si ON am.`staff_id`= si.`staff_id` 

LEFTJOIN related_company AS ri ON am.`related_id`= ri.`related_id` 

LIMIT 0 , 30

 

你可能感兴趣的:(查询)