FinalPrime
Technical User
I'm new to SQL design beyond the simplistic of the simplistic
Column1 is an account-number from Table-A
Column2 is Value1 from Table-B
Column3 is Value2, a summed value from Table-C calculated by reading multiple rows based on the account number
Column4 is Value3, calculated by (Value1 / Value2)
Joining Table-A with Table-B returns one record per account as needed with the account-number and Value1.
Now putting in the Table3 join I get all the values I need to do the sum for Value2, but now have multiple rows.
It appears I need a sub-query to get Value2 and return as an alias.
Value3 then becomes Value1 / alias.
The Sub-query will need to have the aggregate function Sum
Am I on the right tract? Any help would be greatly qppreciated.
Column1 is an account-number from Table-A
Column2 is Value1 from Table-B
Column3 is Value2, a summed value from Table-C calculated by reading multiple rows based on the account number
Column4 is Value3, calculated by (Value1 / Value2)
Joining Table-A with Table-B returns one record per account as needed with the account-number and Value1.
Now putting in the Table3 join I get all the values I need to do the sum for Value2, but now have multiple rows.
It appears I need a sub-query to get Value2 and return as an alias.
Value3 then becomes Value1 / alias.
The Sub-query will need to have the aggregate function Sum
Am I on the right tract? Any help would be greatly qppreciated.