G
G McGuire
I am having trouble setting the criteria to extract data from a table where
some of the the criteria is dependent on a related table.
Here are the relevant fields in the 2 tables
..
Table1:
lng_PassengerID
str_mode
str_status
lng_townID
Table2:
lng_townID
str_townname
lng_postcode
These tables are joined with lng_townID being the common field.
str_mode is either: plane, boat, train, OR car
str_status is either: waiting, planned, tasked OR cancelled
I want to return all records from table1 EXCLUDING those where
table1.str_status = cancelled OR waiting, AND EXCLUDING those where
table1.str_mode = boat, AND EXCLUDING those where table1.str_mode = car with
related table2.lng_postcode between 3000 and 4000
The first two lots of criterea I can handle but the "AND EXCLUDING those
where table1.str_mode = car with related table2.lng_postcode between 3000 and
4000" has got me beat!! Is it possible to do all of this within one query? I
am thinking that I may need to use some SQL as criteria but I'm not having
much success. Any help or guidance would be greatly appreciated.
some of the the criteria is dependent on a related table.
Here are the relevant fields in the 2 tables
..
Table1:
lng_PassengerID
str_mode
str_status
lng_townID
Table2:
lng_townID
str_townname
lng_postcode
These tables are joined with lng_townID being the common field.
str_mode is either: plane, boat, train, OR car
str_status is either: waiting, planned, tasked OR cancelled
I want to return all records from table1 EXCLUDING those where
table1.str_status = cancelled OR waiting, AND EXCLUDING those where
table1.str_mode = boat, AND EXCLUDING those where table1.str_mode = car with
related table2.lng_postcode between 3000 and 4000
The first two lots of criterea I can handle but the "AND EXCLUDING those
where table1.str_mode = car with related table2.lng_postcode between 3000 and
4000" has got me beat!! Is it possible to do all of this within one query? I
am thinking that I may need to use some SQL as criteria but I'm not having
much success. Any help or guidance would be greatly appreciated.