On Tuesday, January 10, 2017, Baxter Allen <
baxter.allen@gmail.com> wrote:
Instead, I would like the output for each individual to be all on a single row:
individual | _id | valA | valB | _id | valC | valD |
1 | 1.table_b | 1 | 2 | 1.table_c | 4 | 3 |
2 | 2.table_b | 4 | 7 | 2.table_c | 3 | 4 |
3 | 3.table_b | 5 | 4 | 3.table_c | 2 | 21 |
The other approach is to "GROUP BY individual" and wrap every other column in an aggregate function that retains the first non-null value in the group (of which there should only be one). I don't recall there being a built-in to do this but I'm certain it can be manually added and examples found on the internet.
David J.