I have to provide an unselected set of values from a group by query to a subquery
Like
Your approach is wrong simply join the tables and aggregate the values
select col2,sum(balance) from tb_1 join accounts a on a.id = tb_1.col3 group by col2;
2.1m questions
2.1m answers
62 comments
56.7k users