Ответить на сообщение
Вернуться к теме
Вы отвечаете на сообщение:
ник: Stanislav Есть два запроса, выводящие список должников: ID должника, Сумма задолженности.
SELECT Sale.CustomerContactID, Sum(nz([ProductCost],0)+nz([DeliveryCost],0)+nz([PaymentCollectionCost],0)+nz([OtherCosts],0)+nz([Tax],0)) AS Debt FROM Sale GROUP BY Sale.CustomerContactID, Sale.IsPaymentReceived HAVING (((Sale.IsPaymentReceived)=False));
SELECT OwnershipTransfer.ContactID, Sum(nz([ProductsCost],0)+nz([OtherCosts],0)+nz([Tax],0)) AS Debt FROM OwnershipTransfer GROUP BY OwnershipTransfer.ContactID, OwnershipTransfer.IsPaymentReceived HAVING (((OwnershipTransfer.IsPaymentReceived)=False));
SELECT CustomerContactID AS Contact, Sum([Debt]) AS SumOfDebt FROM DebtSale UNION SELECT ContactID AS Contact, Sum([Debt]) AS SumOfDebt FROM DebtOwnershipTransfer GROUP BY Contact, SumOfDebt;
Ваше имя:
Пароль:
Сообщение:
Прикрепить:
Для вставки смайлов в текст щелкните по значку.