I have several models that look a little something like this: the parent has a 1-2 M relationship with the Child, and the Child has a 1-2 M relationship with the Sub-Rib.
Parent
Parent_ID
Child
Child_ID,
Parent_ID
Sub-Child
Child_ID,
Version_Number (numeric),
Sent (date),
Void (date)
I need a query that returns a list of unique parent_id, where is the latest version (judging by the version number) of the associated child 'sent' == null, but 'void' != null.
I chewed it in my head and I can not understand what is happening.
Any advice is appreciated.
Thank,
Robert
source
share