Basically, I am trying the following:
SELECT m.col1, SUM(SELECT col5 FROM table WHERE col2 = m.col1)
FROM table AS m
This doesn't seem to work. Is there any solution?
Basically, I am trying the following:
SELECT m.col1, SUM(SELECT col5 FROM table WHERE col2 = m.col1)
FROM table AS m
This doesn't seem to work. Is there any solution?
Why don't you do this:
yes - use joins
Sum is used inside the second select, where we want to sum the column. The col2 may be ambiguous column, if such column exists in the table m.