O/RMs don't help with this kind of situation. They operate at the level of discrete records and translate them to&from objects and object graphs. Here, it's what's in the records that matters, and specifically the relationships of multiple records in the same table. It can't be abstracted to the O/RM level; SQL is the only option.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.