Home > database >  Three tables associated query SQL statements
Three tables associated query SQL statements

Time:10-04

Now have the department table, the staff table, table according to the id of the associated department staff,
Ztree because now want to do a tree, to find out department name, under the department of staff name, staff subordinate departments pid, could you tell me how to write the query to?

CodePudding user response:

 
The select a. d. _name d_id, b.m an_name from t_dept a
Left the join t_man_dept c on a. d. _id=c.d _id
Left the join t_manager b on c. d_manid=b.m an_id
  • Related