Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL How to?
Message
 
 
À
31/10/2007 10:36:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01265385
Message ID:
01265396
Vues:
9
>What's best way to get the following with a SQL statement? I need to be able to get a list of all of the students that have passed three different tests. All of this data is stored in one table with the student id, test description, score and a logical to indicate pass or fail. Each test is stored in a separate record. Thanks in advance.
Try
SELECT mt.* FROM mytable mt
  JOIN mytable mt1 on mt1.studentID = mt.studentID AND mt1.TestId = m.test1 and mt1.passed
  JOIN mytable mt2 on mt2.studentID = mt.studentID AND mt2.TestId = m.test2 and mt2.passed
  JOIN mytable mt3 on mt3.studentID = mt.studentID AND mt3.TestId = m.test3 and mt3.passed
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform