Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/09/2015, 12:25
Avatar de Fernarey1810
Fernarey1810
 
Fecha de Ingreso: noviembre-2008
Mensajes: 214
Antigüedad: 15 años, 5 meses
Puntos: 1
sumar resultado de dos select

TABLA 1 campos
entrega | fecha (tipo DATE)
1000 | 2015-09-14
2000 | 2015-09-15
3000 | 2015-09-16

TABLA 2 campos
entrega | fecha (tipo TIMESTAMP)
1000 | 2015-09-14 06:30:00
2000 | 2015-09-15 06:30:00
3000 | 2015-09-16 06:30:00

Si hago lo siguiente
Código MySQL:
Ver original
  1. select ((select sum(entrega) from entregas) + (select sum(entrega) from entregas_ventas )) AS total

Suma perfecto todo, aunque yo quiero que sea entre fechas, asi:
Código MySQL:
Ver original
  1. select ((select sum(entrega) from entregas where fecha between '2015-09-14' and '2015-09-16') + (select sum(entrega) from entregas_ventas where fecha between '2015-09-16' and '2015-09-16')) AS total

ESTO ME DA NULL A QUE SE DEBE? TIENE ALGO QUE VER QUE UN CAMPO SEA DATE Y EL OTRO TIMESTAMP? creeeria que no influye eso debe ser otra cosa