I have a couple of tables with parent relationships with a daughter. I want to apply the sum function to one column of a child table and return it with all the data in the parent table, for example.
Parent_table
ID, Date, Title
Child_table
ID, another_id, column_to_sum
Sample Data in Parent_table
1, 22-11-2010 00:00:00 , 'Some Title'
2, 13-11-2010 00:00:00 , 'Some Title 2'
Sample Data in Child_table
1, 1, 10
1, 2, 11
1, 8, 3
2, 5, 11
2, 8, 6
The query result should return all columns in parent_tablewith an additional column, that is, sum the values column_to_sumin Child_tablefor each element in parent_table, matched by identifier.
How?
source
share