I need to select unique codes and their sum(value) values. This does not work:
select distinct t1.code, (
select sum(t2.value) from table2 t2
where t2.code = t1.code
)
from table1 t1
example table:
Code Value ABC 1 ABC 2 BCD 12345
expected:
Code Value ABC 3 BCD 12345
actual:
Code Value ABC (null) BCD (null)
Thanks in advance!