php - Fetch list of appointments and in turn all associated notes in single query? -


i'm trying fetch list of appointments, notes associated each appointment, in way php can interface with.

ideally, should like:

select appointment, group_as_object(select note notes notes.appointmentid = appointments.appointmentid) appointments 

the ideal result like

|--appointment--|------------------------note---------------------------| |-----------------------------------------------------------------------| |     | object["some note", "some other note", "another note"]| | else| object["other note", "other note", "another note"]    | |-----------------------------------------------------------------------| 

so can (hopefully?) interact resulting normal results , object via php. needs done in single query though, i'm wondering if possible?

thanks!

this called orm, object relation mapping. in java, such orm api jpa.

i believe there few orm frameworks in php well.

check doctrine project.


Comments