Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/06/2011, 00:40
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 11 meses
Puntos: 574
Respuesta: Duda sobre tablas y relaciones

Código MySQL:
Ver original
  1. Select post.id,post.post,count(*) as NumComentarios
  2. from post left join comentarios
  3. on post.post=comentarios.idpost
  4. group by post.id,post.post
  5. order by NumComentarios;
__________________
Quim
--------------------------------------------------
Ayudar a ayudar es una buena práctica!!! Y da buenos resultados.