Waarom doe je dit niet: SELECT m.col1, (SELECT SUM(col5) FROM table WHERE col2 = m.col1) FROM table AS m