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 IN (1,4)) (returns 2,4,6,14,19,20,23,27)
(TypeIDFK = 5 AND Type IN (3,4)) (returns 3,6,7,8,10,12,33)

So in the end I get only that value of (in this case) potteryID = 6, because
potteryID 6 is the only one what falls into each of the result sets.

Here's a few rows from the look up table that this query needs to run
against

TypeIDFK    Type       PotteryIDFK
----------- ---------- --------------------
5           1          3
4           1          3
4           2          3
3           1          3
1           16         3
2           1          3
5           2          4
4           2          4
3           2          4
1           17         4
2           1          4

There are 5 different TypeIDFKs in another lookup (5 different types of
data)

Hopefully that helps a bit.

On 12/26/05, Sean Corfield <[EMAIL PROTECTED]> wrote:
>
> 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 different values?
>
> He is after another field in the record.
>
> SELECT someKey FROM someTable
> WHERE bigComplexConditionInvolvingOtherKeys


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227689
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to