Ver Mensaje Individual
  #1  
Antiguo 01-10-2018
IVAND IVAND is offline
Miembro
 
Registrado: may 2003
Ubicación: ECUADOR
Posts: 523
Reputación: 21
IVAND Va por buen camino
select con 1 subconsulta

estimados amigos , como siempre gracias por su tiempo

Código SQL [-]
select v.cod_transaccion, sum(d.cantidad) Tcompra,
(select sum(h.cantidad) from his_mov_sucursales h where h.key_producto_b=d.key_producto_b)
 from cab_mov c , det_mov d,vi_configuracion v,vi_producto_bodega vv
where c.key_cab_mov=d.key_cab_mov
and c.key_configuracion=v.key_configuracion
and v.cod_transaccion='ING'
and d.key_producto_b=vv.key_producto_b
and c.key_prov=8
group by 1

como podría hacer esa consulta , miren que primero hago un sum y después de ese dato otro select pero me da error la consulta
de

Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause).

Gracias por su amable atencion
__________________
IVAND
Responder Con Cita