Thanks, I'm aware of it and thought of it, but the code to do this IPN is only
a few lines long. I think it must work and is just something silly; going to
rig it up so I can try it live and see...
~|
Logware (www.logware.us):
Hi All,
I've continued this thread since my new question is about the same issue,
and about SQL code again.
I've got this query
Select * from typelookup
WHERE (TypeIDFK = 1 AND Type IN (3,4))
AND (TypeIDFK = 2 AND Type IN (1,5))
AND (TypeIDFK = 3 AND Type IN (3,4))
AND (TypeIDFK = 4 AND Type IN
Replace your clause joins (AND) with ORs. Right now, you can never get
results cause there is no way that TypeIDFK can equal more than one value.
SQL will parse what you have without parens () since they can be
interchanged and will fail if any of the parts fail.
Try:
Select * from typelookup
sorry I wasn't specific. OR won't work because it needs to match all the
criteria.
There will be items that will match all of the sub clauses. I'm sure I'm
not explaining clearly.
I need the items that exist at the intersection of each clause;
example
(TypeIDFK = 1 AND Type IN (3,4)) (returns
John,
Maybe I cannot quite imagine how your DB is designed... but I am not sure
how it is possible for all of those to return 6 if you AND'ing the TypeIDFK=
parts. I am assuming this is an integer field in the DB table - how can they
ever equal two different values?
...
Ben
On 12/26/05, Ben Nadel [EMAIL PROTECTED] wrote:
Maybe I cannot quite imagine how your DB is designed... but I am not sure
how it is possible for all of those to return 6 if you AND'ing the TypeIDFK=
parts. I am assuming this is an integer field in the DB table - how can they
ever equal two
What Sean said.
I need each of these to (if possible) be something akin to a sub query (I
think)
(TypeIDFK = 1 AND Type IN (3,4)) (returns 6,12,15,16,17,77)
(TypeIDFK = 2 AND Type IN (1,5)) (returns 2,3,5,6,9,12,15,20,22)
(TypeIDFK = 3 AND Type IN (3,4)) (returns 6,33,66)
(TypeIDFK = 4 AND Type
I think this would be a lot easier if you had separate join tables for each
type of join, but I will try and get my head around how this might work with
your universal join table. Can you provide a small representative example of
the data you get if you use the 'OR' version of the WHERE
Sure can.
This query
Select * from typelookup
WHERE
(TypeIDFK = 1 AND Type IN (3,4)) OR
(TypeIDFK = 2 AND Type IN (1,5)) OR
(TypeIDFK = 3 AND Type IN (3,4)) OR
(TypeIDFK = 4 AND Type IN (1,4)) OR
(TypeIDFK = 5 AND Type IN (3,4))
returns
TypeIDFKType PotteryIDFK
--- --
On 12/26/05, John Wilker [EMAIL PROTECTED] wrote:
(TypeIDFK = 1 AND Type IN (3,4)) (returns 6,12,15,16,17,77)
(TypeIDFK = 2 AND Type IN (1,5)) (returns 2,3,5,6,9,12,15,20,22)
(TypeIDFK = 3 AND Type IN (3,4)) (returns 6,33,66)
(TypeIDFK = 4 AND Type IN (1,4)) (returns 2,4,6,14,19,20,23,27)
10 matches
Mail list logo