1

Topic: Help the beginner to make advanced query

There are 3 tables: , SpisokRashodnyhDokumentov and RashodTmTs

2

Re: Help the beginner to make advanced query

It is necessary to receive the table containing all lines from the table SpisokRashodnyhDokumentov and accordingly an amount of a certain material. Somehow so:

3

Re: Help the beginner to make advanced query

maxicooler;

Declare @_ int = 1;
Select . ;
isnull (sum (. _), 0) as Kolvo_RashodOpredelnnojTmTs
From 
left join  on . _ = . _ and . _ = @_
Group by . 

4

Re: Help the beginner to make advanced query

Thanks! Works! I will understand as

5

Re: Help the beginner to make advanced query

maxicooler;
..... The linear request from two tables with  and aggregation is an advanced query, with which it is impossible to understand, writing it?

6

Re: Help the beginner to make advanced query

Kind  - Eh;
Well Siri probably could not write this request, therefore the difficult.
[youtube=vzM_1NO2xio]

7

Re: Help the beginner to make advanced query

Well, not the difficult. The second day only I smoke docks. What for these ? And so I am clear that  in this question. And close already my first subject. To all who helps to study in THANKS!

8

Re: Help the beginner to make advanced query

maxicooler;
Smoke sql-ex.ru on this site there are test jobs and teaching materials to them when this site fine started to understand in SQL to me helped to understand principles of a spelling of requests.