Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Filtering without Group By and Having ?
Message
 
À
07/12/2001 09:34:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00590837
Message ID:
00591243
Vues:
25
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") ...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform