Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/12/2015, 09:53
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 8 meses
Puntos: 774
Respuesta: Unir una tabla con el numero de registros de otra

Código MySQL:
Ver original
  1. SELECT id, cliente, foto, id_cliente FROM `tbl_fotos` as t1
  2. left join (SELECT count(email), id_cliente FROM `tbl_fotos` group by id_cliente) as t2 on (t1.id_cliente=t2.id_cliente)
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me