mysql join count lines in third table -
i have 3 mysql-tables this:
client network activities \_id \_id \_id \_name \_name \_client_id \_[...] \[...] \_[...] \_network_id
now want have following result:
client.*, network.name, number_of_activities_for_each_client
actually have select-statement:
select client.*, network.name client left join network on client.network_id = network.id
how extend statement? see clients.
select c.*, n.name, count(a.id) number_of_activities_for_each_client clients c left join network n on n.id = c.network_id left join activities on a.client_id = c.id group c.id
Comments
Post a Comment