Ukończenie kursu - kwerenda.

Odp: Re: Polski Moodle: Odp: Ukończenie kursu - kwerenda.

Napisane przez: Bartek Kowalski ()
Liczba odpowiedzi: 0

Chciałem przerobić tę kwerendę (poniżej) bo nad nią pracowałem wcześniej. Ona zaczytuje dane z pola user, ale jak zmieniam na grade_grades to wywala mi cały czas błąd, że w strukturze tej tabeli nie ma takiej części. 

SELECT  firstname, lastname, department AS "Region", ccat.name AS "Kategoria Kursu",c.fullname as "Nazwa Kursu",

case 

  when ccom.timecompleted IS NULL then 'Nie Ukończony' 

  when ccom.timecompleted IS NOT NULL then 'Ukończony'

end as "Status ukończenia"

FROM {user} AS u 

  JOIN {course_completions} AS ccom ON u.id = ccom.userid

  JOIN {course} AS c ON c.id = ccom.course

  JOIN {course_categories} AS ccat ON c.category = ccat.id

WHERE department ='1-235' or department ='1-259' or department ='1-261' or department ='1-262' or department ='1-263' or department ='1-304' or department ='1-318' or department ='1-330' or department ='1-364' or department ='1-366' or department ='1-391' or department ='1-409' or department ='1-477' or department ='1-700' or department ='1-701' or department ='1-708' or department ='1-091' or department ='1-094' and u.deleted = 0 and u.suspended = 0

ORDER BY u.email,ccat.name,c.fullname