Ver Mensaje Individual
  #6 (permalink)  
Antiguo 22/05/2009, 09:33
Avatar de Genetix
Genetix
 
Fecha de Ingreso: febrero-2002
Ubicación: Lima - Perú
Mensajes: 1.600
Antigüedad: 22 años, 2 meses
Puntos: 45
Respuesta: Liado con SELECT.... JOIN....

Prueba Usando Left Join
Código sql:
Ver original
  1. SELECT
  2.    c.categoria ,
  3.    COUNT(*) productos
  4. FROM tbl_categorias c LEFT JOIN tbl_productos p ON c.id = p.id_categoria
  5. ORDER BY c.categoria
  6. GROUP BY c.categoria;

Saludos!
__________________
"El conocimiento nos hace responsables."
twitter: @benjamingb
blog personal: http://codigolinea.com
ZF Manual en español http://manual.zfdes.com