Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filtering without Group By and Having ?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00590837
Message ID:
00591243
Views:
24
Jay,

Here's a fairly good example for using subselects.

Background:

Employee table one rec of each person

Training table one rec for each training program for each person

employees are "on probation" until they complete their orientation and OSHA training programs

Question:
create a list of employees that are NOT on probation

Answer:
There is only one way to get the answer and that is;
SELECT Employee.* ;
  FROM Employee JOIN Training ;
    ON Employee.EmpId = Training.EmpId ;
 WHERE Training.Program = "Orientation" ;
   AND Employee.EmpId IN ;
       (SELECT EmpId ; 
          FROM Training ;
         WHERE Program = "OSHA") ...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform