запрос:
select Our_Acc = tr1.Brief,
Number = replicate(" ",4-datalength(substring(to1.Number,1,4))) +
substring(to1.Number,1,4),
Data = to1.OperDate,
Pol_Acc = tr2.Brief,
Sm = to1.QtyBs,
Pk = tpu.Brief
from tOperPart to1 (index XIE8tOperPart),
tOperPart to2 (index XPKtOperPart),
tResource tr1 (index XPKtResource),
tResource tr2 (index XPKtResource),
tPropertyUsr tpu (index XPKtPropertyUsr)
where ---to1.BalanceID = 2140
--and
to1.InstitutionID = 2000
and to1.OperDate = (:val)
and to1.CharType = 1
and to2.OperationID = to1.OperationID
and to2.CharType = -1
and tr1.ResourceID = to1.ResourceID
and tr2.ResourceID = to2.ResourceID
and to1.BatchID = tpu.PropertyUsrID
and tpu.PropertyType = 6
order by pk, our_acc, sm
код в проге:
...
q1.Close;
q1.SQL.Clear;
q1.SQL.LoadFromFile('sql1.sql');
q1.ParamByName('val').Value:=d1;
q1.Open;
......| Модератор: Пользуйтесь тегом (кнопкой) SRC для оформления кода, пожалуйста. |