Please can somebody help me with this query. I have a table called Grades containing ClassID (text), StudentID (text), ReportNumber (integer), Points (Integer)
ClassID, StudentID and ReportNumber can be used as a compound key to reference a particular Points value. I am trying to write a query, grouped by ClassID, to return the percentage of students in each class whose points for ReportNumber = 6 is more than the points for ReportNumber = 5 (for the same classID). The ReportNumbers can be hard coded for the moment. I might use parameters later. I'm looking for a result something like ClassID PercentOfImprovedStudents ==== ================= Eng1 56.6 Math2 60.3 Geog2 34.6 etc Ideally I'd also like the total number of students in each class and the number who have improved their points. (This is necessary to give meaning to the percentage.) I've tried playing around with self joins but am not getting very far. Any help would be gratefully received. Thanks -- View this message in context: http://sqlite.1065341.n5.nabble.com/Help-with-a-self-join-please-tp71242.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users