[odb-users] making query with nested relationships

Michael Martín Moro sexymimi64 at gmail.com
Mon Apr 11 08:06:14 EDT 2016


I want to make a rather complex query, and I'm wondering how to put it in
ODB's terms.

I have these objects:

Event has one SubjectDetails
SubjectDetails has many StudentGroups
StudentGroup has a degree and course attributes.

I need to fetch all the Events who are related to StudentGroups with a
given degree and course attribute.

Basically, I would need something such as:
odb::pgsql::query<Event>::subject_details->student_group->degree == 1 &&
odb::pgsql::query<Event>::subject_details->student_group->course == 2

But I haven't found a way to write such requests yet. I'm not even sure
it's possible, even using Views. Maybe I'm not looking in the right

Any help with that would be very welcome.
*Michaël Martín Moro*
{ Epitech. Tek4 }
{ UCA Cadíz - Computer Engineering }

More information about the odb-users mailing list