Please see my other Database Development articles.
Performing multiple, concurrent queries
Often when needing a resultset, there’s a need to perform multiple queries to derive the desired data.
In this example, we have multiple records of people, from which we need an aggregated report.
In order to accomplish this goal, I must perform two separate queries on the same data.
First, I list each person’s age, the sum of all peoples’ ages, then their age as a percentage compared against the total of all ages.
The final data illustrates the intended aggregation.