View Single Post
  #8 (permalink)  
Old June 20th, 2005, 04:42 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 33,170, Level: 79
Points: 33,170, Level: 79 Points: 33,170, Level: 79 Points: 33,170, Level: 79
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,161
Thanks: 7
Thanked 188 Times in 186 Posts
Default

I am still not sure I understand what you want, but it sounds like you can use an IN clause in your queries.

Something like this:

SELECT Id FROM SomeTable WHERE LocationId NOT IN (SELECT Id FROM Location WHERE SomeColumn = SomeValue)

In this example, the sub query (SELECT Id FROM Location...) returns a list with Ids that match some criteria. The outer query then uses that list to retrieve all the records whose Id doesn't match those in the list return by the sub query.

A trivial example, but I think you'll understand what I mean. You can use the IN clause, wrap some hocus pocus around it involving boxes, freezers, locations and what more, and it might work... ;)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Three by Massive Attack (Track 3 from the album: Protection) What's This?
Reply With Quote