Mysql
 sql >> Database >  >> RDS >> Mysql

Come contare le righe in una tabella in base a un'altra tabella in mysql

SELECT d.abbreviation, COUNT(*) num
FROM departments d
INNER JOIN courses c ON c.section LIKE CONCAT(d.abbreviation, "%")
GROUP BY d.abbreviation

Sql Fiddle