Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2009, 14:13
giankrlo
 
Fecha de Ingreso: diciembre-2009
Mensajes: 5
Antigüedad: 14 años, 5 meses
Puntos: 0
¿Como igualo una consulta select a un campo de otra?

Expertos, quisiera que me ayuden con urgencia; deseo insertar un query a un campo de un select..... Ayudenme por favor.

Como pueden ver quiero introducir un select al nuevo campo 'SALDO ANTERIOR'. Gracias

select a.ccod_art, a.cnro_lote, a.dfch_vcto,
'SALDO ANTERIOR'=(select ISNULL(SUM(a.nund_tot_ing - a.nund_tot_sal), )
from al_axslotes a left join al_mvlotes b on a.ccod_art = b.ccod_art
where a.ccod_cia = 'DPH' and a.ccod_alm = '22' and SUBSTRING(a.ccod_art, 5, 1)= '1' and a.ccod_art = '0203100730' and a.ccod_per = 'EJ0812' and b.ddoc_fch between '2009-01-01' and '2009-01-31'),
b.nund_ing, b.nund_sal
from al_axslotes a
left join al_mvlotes b on a.ccod_art = b.ccod_art
where a.ccod_cia = 'DPH' and a.ccod_alm = '22'
and SUBSTRING(a.ccod_art, 5, 1) = '1'
and a.ccod_art = '0203100730' and a.ccod_per = 'EJ0901'
and b.ddoc_fch between '2009-01-01' and '2009-01-31'