3 messages in com.mysql.lists.mysql-esRe: Error en consulta
FromSent OnAttachments
Reynier Perez Mira13 Oct 2006 20:07 
Edwar Ponte14 Oct 2006 06:49 
Juan Navas16 Oct 2006 01:27 
Subject:Re: Error en consulta
From:Edwar Ponte (edu@gmail.com)
Date:10/14/2006 06:49:29 AM
List:com.mysql.lists.mysql-es

Hola Reyner

prueba con esto

SELECT categoria.id_categoria , categoria.nombre , COUNT(noticia.id_categoria) AS cant_noticias FROM smp_categorias_noticias AS categoria LEFT JOIN smp_noticias AS noticia ON categoria.id_categoria = noticia.id_categoria GROUP BY categoria.id_categoria

On 10/13/06, Reynier Perez Mira <rper@estudiantes.uci.cu> wrote:

Hola lista: Tengo esta consulta y me está dando un error pero no encuentro el fallo por ningún lado. He revisado el manual de MySQL buscando la sintaxis de SELECT por si ordene mal algún elemento pero nada de nada.

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE categoria.id_categoria = noticia.id_categoria GROUP BY cat

SELECT categoria.id_categoria, categoria.nombre, COUNT( noticia.id_categoria) AS cant_noticias FROM smp_categorias_noticias AS categoria LEFT JOIN smp_noticias AS noticia WHERE categoria.id_categoria = noticia.id_categoria GROUP BY categoria.id_categoria

¿Alguna ayuda ? Salu2 y desde ya gracias