consulta

tema enviado por sandy en SQL
tema iniciado el 30/03/2009

select "Total" estado, t1.t_orno pedido, t1.t_cofc codepa, date(t2.t_fcre) fcr,
  t3.t_pono posicion, date(t2.t_fcan) fcancela,
  t4.t_nama Cliente, t5.t_nama Ejecutivo,
  substring(T3.T_ITEM from 10 for 20) codigo, (select n1.t_dsca
  from
  ttccfe986455 n1
  where n1.t_item = t3.t_item) des_item, t3.t_oqua cant,
  t3.t_pric precio, t3.t_oqua * t3.t_pric total_bruto,
  t6.t_dsca departamento, t6.t_area linea
    /***/
//  (select SUM(r3.t_oqua)
//  from ttdsls400455 r1, ttdcfe986455 r2, ttdsls401455 r3
//  where r1.t_orno = r2.t_orno
//  and r1.t_orno = r3.t_orno
//  and r1.t_lstofca = 1
//  and r1.t_clyn = 2
//  and r3.t_clyn = 2
//  and r1.t_sotp not in ("V02", "V03", "V12", "V11")
//  and r3.t_sqnb = 0
//  and r2.t_fcre > date(t2.t_fcan)
//  and substring(r3.t_item from 10 for 20) = substring(T3.T_ITEM from 10 for 20)) as Usada_en_otros_pedidos
/******/
from ttdsls400455 t1, ttdcfe986455 t2, ttdsls401455 t3, ttccom100455
t4, ttccom001455 t5, ttdsls012455 t6
where t1.t_orno = t2.t_orno
and t1.t_cofc = t6.t_cofc
and date(t2.t_fcre) > date('01/01/1970')
and t1.t_lstofca = 1
and t1.t_clyn = 1
and t1.t_sotp not in ("V02", "V03", "V12", "V11")
and t1.t_orno = t3.t_orno
and t3.t_sqnb = 0
and t3.t_item > "A"
and t1.t_ofbp = t4.t_bpid
and t1.t_crep = t5.t_emno
order by 4 desc;

 

La subconsulta que esta comentada al generar se me cuelga el sistema, necito sabe otra forma de generar ya que las consultas de las tables principales creo se repiten por  lo que causa una operación ciclica,