Answer the question
In order to leave comments, you need to log in
How to merge 2 sql queries into 1?
there are two subqueries in access, we need to combine them into one
qr_0 subquery:
SELECT Типы.[Код типа], Sum(Заказано.[Итого со скидкой]) AS [Sum-Итого со скидкой]
FROM (Типы INNER JOIN [Древесина (Чимал)] ON Типы.[Код типа] = [Древесина (Чимал)].[Код Типа]) INNER JOIN Заказано ON [Древесина (Чимал)].[Код Чимала] = Заказано.[Код Чимала]
GROUP BY Типы.[Код типа];
SELECT Обходы.Название, Типы.[Код типа], Sum(Заказано.[Итого со скидкой]) AS [Sum-Итого со скидкой1], qr_0.[Sum-Итого со скидкой]
FROM ((Типы INNER JOIN (Обходы INNER JOIN [Древесина (Чимал)] ON Обходы.[Код обходщика] = [Древесина (Чимал)].[Код обходчика]) ON Типы.[Код типа] = [Древесина (Чимал)].[Код Типа]) INNER JOIN Заказано ON [Древесина (Чимал)].[Код Чимала] = Заказано.[Код Чимала]) INNER JOIN qr_0 ON Типы.[Код типа] = qr_0.[Код типа]
GROUP BY Обходы.Название, Типы.[Код типа], qr_0.[Sum-Итого со скидкой]
HAVING (((Обходы.Название)=[назв обх]));
Answer the question
In order to leave comments, you need to log in
I can’t digest something, but judging by the fact that in both queries in GROUP BY you have a common field Types. [Type code] , you can do an inner join through it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question