Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL How to?
Message
 
 
To
31/10/2007 10:36:19
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01265385
Message ID:
01265396
Views:
8
>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--
Previous
Reply
Map
View

Click here to load this message in the networking platform