que modificaciones debo hacerle?
Código:
select nmro_dcmnto as Factura, cdgo_clnte as Cliente, cdgo_prdo as Periodo, fcha_dcmnto as fecha_fac, fcha_vncmnto as Vencimiento, fcha_ultmo_pgo as Pago, vlor_incial as Valor, sldo as saldo, (fcha_vncmnto - fcha_ultmo_pgo) as Dif from mstro_crtra where cdgo_tpo_d="FAC" and cdgo_prdo between 200801 and 200812 and cdgo_clnte = 30397 into temp t1 select count(*) as menor from t1 where saldo = 0 and Dif < 0 union select count(*) as mayor from t1 where saldo = 0 and (Dif = 0 or Dif > 0 )