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:
SELECT m.col1, (SELECT SUM(col5) FROM table WHERE col2 = m.col1)
FROM table AS m