I need to mount a query that displays the names of all categories, and in front of each name the total number of products.
The tables are:
Categorias (cat_codigo, cat_nome)
Produtos (pro_codigo, pro_codigo_categoria pro_nome)
Exemplo:
Parafusos (58)
Brocas (42)
Chaves (33)
I can make the links between the two tables, but I am in doubt about getting the total amount:
select * from categorias CAT LEFT JOIN produtos PRO ON CAT.cat_codigo=PRO.pro_codigo_categoria