SUM() across multiple tables

Thanks for your help.

I get an output like this:

Array ( [1] => Array ( [amount] => 1.89 [revenu] => 0.70 ) [5] => Array ( [revenu] => 1.27 ) )

Is there any way to get the numeric key to not show the user id and have the userid as part of the array. Also, if there is no ‘amount’ in the first table, then can we set a default value to 0?

An ideal output would be this:

Array ( [0] => Array ( [amount] => 1.89 [revenu] => 0.70 [userid] => 1) [1] => Array ( [amount] => 0.00 [revenu] => 1.27 [userid] => 2) )

Thanks in advance.