Skip to content
Snippets Groups Projects
issue316_discipline_noteachers.sql 572 B
Newer Older
drop function if exists public.faculty_getdeans(pfacultyid integer);
CREATE OR REPLACE FUNCTION public.faculty_getdeans(pfacultyid integer)
 RETURNS TABLE("FullName" character varying, "AccountID" integer, "TeacherID" integer)
 LANGUAGE plpgsql
AS $function$
begin
  return query
  select GetUserFullNameByAccountID(accounts.ID) as "FullName",
         accounts.id as "AccountID",
         teachers.id as "TeacherID"
  from accounts
  join teachers on teachers.accountid = accounts.id
  where teachers.facultyid = pfacultyid and accounts.userroleid = 4;
END;
$function$;