Home > database >  SQL statements a one-to-many relationship
SQL statements a one-to-many relationship

Time:11-13

SELECT c *, BC. DepartmentId FROM Company c LEFT JOIN BranchCompany BC ON b.i d=bc.com panyId Group by c.i d

Business requirements:
Company with BranchCompany two tables is a one-to-many relationship, query the Company details of the data, as well as BranchCompany departmentId field data, in the form of a string concatenation returns, SQL should be how to write?
Beg god give directions!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

Used for XML path should be able to meet the demand,
  • Related