Ver Mensaje Individual
  #4 (permalink)  
Antiguo 04/05/2012, 08:59
YoLO10
 
Fecha de Ingreso: agosto-2010
Ubicación: Actualmente en Bilbao-España
Mensajes: 35
Antigüedad: 13 años, 8 meses
Puntos: 0
Respuesta: me podrían ayudar con un case when por favor

Al final utilice este;
Código MySQL:
Ver original
  1. SELECT nombre_padre, nombre_madre,facturas.id,
  2. (
  3. SELECT sum(total)
  4. from actividades
  5. where facturas.id=actividades.id_factura and facturas.pagado=1
  6. ) AS PAGADO ELSE '0',
  7. (
  8. SELECT sum(total)
  9. from actividades
  10. where facturas.id=actividades.id_factura and facturas.pagado=0
  11. ) AS Deuda ELSE '0'
  12. FROM facturas, padres
  13. WHERE facturas.id_padres=padres.id and facturas.ano=2012 and facturas.mes=1

Muchisimas gracias por la ayuda :D...