Suppose that the two table a,b,b is associated with a table through a field ID, and a table has a one-to-many relationship with Table B. Assuming that a field name exists in table B, you now need to query the records in table A. Get the name information stored in table B, as usual, how many rows are displayed in table B, and if you need to show only the number of rows in table A, you need to merge the multiline records from the Query Name field. Can be implemented programmatically, but can also be done directly at the SQL layer.
Method:
Using the Group_concat () method, the parameter is a field that needs to be merged, and the merged field is delimited Fummer think of the comma, which can be specified by parameter separator, which is often used with group by.
Example:
Select A.*,group_concat (b.name separator '-') as name from a LEFT join B on A.id=b.id GROUP by a.ID;