Skip to content
Snippets Groups Projects
Commit 1a581865 authored by RomanSteinberg's avatar RomanSteinberg
Browse files

ADD: get students not attending discipline by groupID and so on

parent cfb04bee
Branches
Tags
No related merge requests found
...@@ -1031,7 +1031,44 @@ BEGIN ...@@ -1031,7 +1031,44 @@ BEGIN
END // END //
DROP PROCEDURE IF EXISTS getStudentsNotAttendingDiscipline//
CREATE PROCEDURE `getStudentsNotAttendingDiscipline` ( IN `Grade` INT,
IN `StudyGroupID` INT,
IN `FacultyID` INT,
IN `Last` VARCHAR(30) CHARSET utf8,
IN `First` VARCHAR(30) CHARSET utf8,
IN `Second` VARCHAR(30) CHARSET utf8,
IN `DisciplineID` INT
)
NO SQL
BEGIN
SELECT students.ID AS 'StudentID',
students.LastName AS 'StudentLast',
students.FirstName AS 'StudentFirst',
students.SecondName AS 'StudentSecond',
study_groups.Grade AS 'GroupGrade',
study_groups.GroupNum AS 'GroupNum'
FROM `students`
INNER JOIN `study_groups` ON students.StudyGroupID = study_groups.ID
INNER JOIN `specializations` ON study_groups.SpecializationID = specializations.ID
LEFT JOIN `disciplines_students` ON students.ID = disciplines_students.StudentID AND
DisciplineID = disciplines_students.DisciplineID
LEFT JOIN `disciplines_groups` ON disciplines_groups.StudyGroupID = study_groups.ID AND
DisciplineID = disciplines_groups.DisciplineID
WHERE ( Grade = 0 OR study_groups.Grade = Grade) AND
( StudyGroupID = 0 OR study_groups.ID = StudyGroupID) AND
( FacultyID = 0 OR specializations.FacultyID = FacultyID) AND
( students.LastName LIKE CONCAT(Last,"%") ) AND
( students.FirstName LIKE CONCAT(First,"%") ) AND
( students.SecondName LIKE CONCAT(Second,"%") ) AND
( ( disciplines_students.Type IS NOT NULL AND disciplines_students.Type = 'detach' ) OR
( disciplines_groups.ID IS NULL AND disciplines_students.Type IS NULL )
)
ORDER BY study_groups.Grade ASC, study_groups.GroupNum ASC;
END //
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment