I don't dispute the answer, but I don't completely agree, or understand the explanation;
"The total rows count will be 1*2*3=6! The summary of id3 will be 2*1+2*2+2*3=12! "
Yes, the row count formula is correct, multiply the number of rows from each table, will work for any number of tables that are joined.
The problem I have is the supposed formula to arrive at the SUM. The true formula is 1+2+3+1+2+3 = 12. I don't see how you can apply any multiplication into this formula, at least to a formula that could be used for any set of data/tables, simply doesn't work for SUM.
For example, extrapolate the exercise to include a 4th table, with four values (1,2,3,4), same final select using id4. The results are 60 and 24. The COUNT of 24 works perfectly using and continuing on with the formula 6*4, but how would you continue on using the formula provided for determining the SUM? You can't! SUM by definition "adds" the values together. Only real formula for that one would be: 1+2+3+4+1+2+3+4+1+2+3+4+1+2+3+4+1+2+3+4+1+2+3+4=60
Very good explanation Hugo!
I like to think of it in sets of the table and use the properties of multiplication to simplify the problem.
So, for the qotd you have 1 set of Table 2 = 2 rows. (T1 = 1 row, T2 = 2 rows, Cross = 2 rows).
Add Table 3 you get 2 sets of 3 rows (T1xT2 = 2 rows, T3 = 3 rows, Cross = 6 rows).
Count of Table 3 = 6 (above)
Sum Table 3 ID you get 2 sets of Table 3 so: (1+2+3)*2 = (6)*2 = 12
Add Table 4 from the explanation and you get
Table 4 is 6 sets of 4 rows (T1xT2xT3 = 6 rows, T4 = 4 rows, Cross = 24 Rows).
Count of Table 4 ID = 24 (above)
Sum is 6 sets of table 4, so: (1+2+3+4)*6 = (10)*6 = 60
You can simplify it to this semi-abstract:
X = SUM(Value)*COUNT(Cross)
where Value is the item of the table to sum, and COUNT(Cross) is the number of rows in the first N-1 tables.