the base table is TABLE_1.
I want to "join SUM values" from TABLE_2 to TABLE_1 based on columns NUMBER and TOOL like IMAGE below.
I ve tried to use LEFT JOIN but didnt get result like this in IMAGE.
Can someone give me a hint or write query for this?
Thank you.
2
Answers
In the meantime I did it in microsoft sql server management studio. He has "query designer" and he helped me to do it right:
Thank you anyway, by!
You can achieve this using a
LEFT JOIN
andSUM
function.This query will join the two tables based on matching
NUMBER
andTOOL
columns, and then group the results byNUMBER
andTOOL
. The SUM function is used to calculate the sum of values fromVALUE
column intable_2
for each group.db<>fiddle output