Really complicated query (or not?)
Really complicated query (or not?)
- Subject: Really complicated query (or not?)
- From: Miguel Arroz <email@hidden>
- Date: Sun, 8 Jul 2007 02:53:12 +0100
Hi!
I need to build a complex fetch spec to solve a weird problem.
Here's the part of the model that matters:
+-----+ +-----+ +------+ +------+
| R | <--->> | A | <--->> | AP | <<---> | QO |
+-----+ +-----+ +------+ +------+
^
^
|
|
V
+------+
| QP |
+------+
My goal it to count the Rs in a given situation (it's the same as
fetching them, but I'm using Wonder to count instead of fetch). And
the crieria I want is:
1) All Rs where I have an APs with aValue property = "x" and QO =
"qo" and QP = "qp".
2) All Rs where I have an APs with aValue property = "y" and QO =
"qo2" and QP = "qp2".
(each R will have only one AP for condition 1 and one AP for
condition 2)
I want to AND those two conditions. In practice, I have two sets
of APs, and I want the Rs' that are in both sets (the intersection of
Rs).
Also, I want to do this all in the same query. I'm talking about
huge numbers of objects, so I don't want to get all the PKs of the
APs, and then work with them in memory to obtain Rs.
Any ideia how to do this? I think the solution may be
ERXQualifierInSubquery, but I couldn't make it work (specially
because the "3 argument constructor" is actually a 4 argument
constructor...).
My problem is that making a qualifier for R with the format
"a.ap.qo = %@ and a.ap.qp = %@ and a.ap.aValue = %@" wouldn't work,
because I would not be selecting the same AP, right? I'm saying that
I want Rs with an AP with a certain QO, and an AP with a certain QP
but i'm not saying they MUST be the same.
Please please give me some hints, I really need to make this work.
If you want more details just ask, it's almost 3am here and my mind
is really confused with this.
Yours
Miguel Arroz
Miguel Arroz
http://www.terminalapp.net
http://www.ipragma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden