I have 2 tables:
Table person with columns: person_id, person_name
Table pet with columns: pet_id, owner_id, pet_name
person data: 1, 'John' 2, 'Jill' 3, 'Mary' pet data: 1, 1, 'Fluffy' 2, 1, 'Buster' 3, 2, 'Doggy' How to write a SELECT query from person left join pet on person_id = owner_id with aggregate functions so my result data looks like:
1, [{pet_id:1,pet_name:'Fluffy'},{pet_id:2,pet_name:'Buster'}], 'John' 2, [{pet_id:3,pet_name:'Doggy'}], 'Jill' 3, [],'Mary'