Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/06/2013, 17:35
samito111
 
Fecha de Ingreso: abril-2012
Mensajes: 106
Antigüedad: 12 años
Puntos: 2
contador de registros

tengo 2 tablas:
tabla 1 tema:id_tema,titulo_temadescripcion_tema,fecha,hor a
tabla 2 comentarios:id_comentario,descripcion_comentario,i d_tema


la consulta que quiero realizar es la siguiente:
seleccionar todos los temas y el numero de comentarios que tiene cada tema.
por ejemplo :
en la tabla tema hay 4 registros
tema 1,tema2,tema3,tema4
y en la tabla comentario hay 6 registros
registro1,registro2,registro3,registro4,registro5, registro6


el registro 1 y 2 pertenece a tema1
el registro 3 y 4 y 5 pertenece a tema2
el registro 6 pertenece a tema3
0 registros para el tema4
por lo que diriamos que
el tema 1 tiene 2 registro
el tema 2 tiene 3 registro
el tema 3 tiene 1 registro
el tema 4 tiene 0 registro