Please consider the following dataset: This is a result of SQL query that uses a join on
LEFT JOIN t1 on t2.parentid = t1.id
t1.parentid | t2.childid | t1. amount
A | B | 500
A | C | 500
D | E | 100
I need to prorate the amount value for records having the same parentid so that sum(amount) = 600 not 1100.
I tried using a simple calculation but encounter the error “not allowed aggregate and nonaggregate data together”.