Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get counts in returned recordset
Message
From
13/07/2004 09:14:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/07/2004 06:29:39
Steven Kleypas
Tarrant County College District
Texas, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00923610
Message ID:
00923670
Views:
16
This message has been marked as a message which has helped to the initial question of the thread.
>I want a list of courses with the number of students who pass and fail each one. The following is what I am working with, but am having no luck getting correct numbers for the nPass and nFail vars. Would anyone have a suggestion?
>
>SELECT Courses.ctitle,Courses.tstartdate, ;
>       Courses.csectnum, Courses.iid,;
>  COUNT(students.cstatus = "PASS" ) AS nPass,;
>  COUNT(students.cstatus = "FAIL" ) AS nFail;
> FROM  regman!courses INNER JOIN regman!students ;
>   ON  Courses.iid = Students.icourseid;
> GROUP BY Courses.csectnum;
> ORDER BY Courses.tstartdate
>
SELECT Courses.ctitle,Courses.tstartdate, ;
       Courses.csectnum, Courses.iid,;
  sum(iif(students.cstatus = "PASS",1,0)) AS nPass,;
  sum(iif(students.cstatus = "FAIL",1,0)) AS nFail,;
 FROM  regman!courses INNER JOIN regman!students ;
   ON  Courses.iid = Students.icourseid;
 GROUP BY Courses.ctitle,Courses.tstartdate, Courses.csectnum ;
 ORDER BY Courses.tstartdate
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform