简体   繁体   中英

Retrieve data from MySQL using Node.JS in nested JSON format

I have the following sql tables enter image description here

enter image description here

Now I want to get all the data in a single query I am using Node.JS and I wrote the following query

SELECT * FROM person_table INNER JOIN event_table ON person_table.person_id = event_table.person_id

Now I get the following response enter image description here

but I want output as follows which is nested json format enter image description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM