Click to See Complete Forum and Search --> : Simple SQL Question


Hysteria86
05-27-2009, 11:52 AM
Hi,
I'm just wondering if this statement is logically possible in SQL. I'm writing this example in semi-pseudo code.

I have two tables:
persons (a group of people, each has an id)
travelling persons (the specific members of the group travelling on a particular journey, again with their id, if they are not travelling they have a field 'deleted' set to 'Y'.

Basically I want to retrieve results where:

persons.id IS NOT EQUAL TO travelling_persons.id (WHOSE DELETED FIELD IS SET TO 'Y')

aj_nsc
05-27-2009, 01:01 PM
Very convoluted and confusing post (in my opinion, I may just be a bit slow). If some of these persons are not traveling (i.e. have a deleted field set to Y) then why are they even listed in the traveling table?

I'm sure I can help, but reading your post gave me a headache, try to explain exactly what result set you want to get, rather than a funny looking query - it looks to me like you want to get a list of all the persons that are not listed in the traveling table (persons.id IS NOT EQUAL TO traveling.id)

OR

are you using this to try and get a single record to determine if a person is not traveling - i.e. if a person is not listed in the traveling table, or if they are listed, but their deleted field is set to Y?