Показать сообщение отдельно
Старый 13.05.2008, 16:47   #9  
NNB is offline
NNB
Участник
 
103 / 12 (1) ++
Регистрация: 31.08.2006
Что-нибудь в таком духе. Писал впопыхах. Не перечитывал. Мог ошибиться.

while select AccountNum, RContractAccount, Sum(AmountCur) from VTr group by RContractAccount
join Name from VT group by AccountNum, Name where VT.AccountNum==VTr.AccountNum
join RContractCode from RT group by RContractCode where RT.RContractAccount==VTr.RContractAccount &&
VTr.closed {
// if .....
//Что-нибудь insert()
}