Skip to content
Snippets Groups Projects
Commit 17955a49 authored by RomanSteinberg's avatar RomanSteinberg
Browse files

add: isAuthor in GetTeachersForDiscipline

parent 1a581865
Branches
Tags
No related merge requests found
......@@ -1124,6 +1124,22 @@ BEGIN
WHERE disciplines.ID = DiscID;
END //
DROP FUNCTION IF EXISTS isAuthorOfDiscipline//
CREATE FUNCTION `isAuthorOfDiscipline`( `DisciplineID` INT,
`TeacherID` INT
) RETURNS int(11)
NO SQL
BEGIN
DECLARE checker INT;
SELECT disciplines.AuthorID
INTO checker
FROM `disciplines`
WHERE disciplines.ID = DisciplineID
LIMIT 1;
RETURN (checker IS NOT NULL AND checker = TeacherID);
END //
DROP PROCEDURE IF EXISTS GetTeachersForDiscipline//
CREATE PROCEDURE `GetTeachersForDiscipline`(IN `DiscID` INT)
......@@ -1140,7 +1156,8 @@ BEGIN
departments.Name AS 'DepName',
faculties.ID AS 'FacultyID',
faculties.Name AS 'FacultyName',
faculties.Abbr AS 'FacultyAbbr'
faculties.Abbr AS 'FacultyAbbr',
isAuthorOfDiscipline(DiscID, teachers.ID) AS 'isAuthor'
FROM `disciplines_teachers`
INNER JOIN `teachers` ON teachers.ID = disciplines_teachers.TeacherID
INNER JOIN `departments` ON departments.ID = teachers.DepartmentID
......
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