B

SELECT `class`, `discipline`,
SUM(IF(`type`='Лабораторная', `count_students`, 0)) AS `count_students`,
SUM(IF(`type`='Лекция', `count_hours`, 0)) AS `lection`,
SUM(IF(`type`='Семинар', `count_hours`, 0)) AS `seminar`,
SUM(IF(`type`='Лабораторная', `count_hours`, 0)) AS `lab`,
SUM(`type`='Лекция') AS `groups`,
SUM(`type`='Лабораторная') AS `subgroups`,
count('id') AS `numbe`,
`course_semestr`, `profile`, `id`,
(SUM(IF(`type`='Лекция', `count_hours`, 0)) --
+ SUM(IF(`type`='Семинар', `count_hours`, 0)) --
+ SUM(IF(`type`='Лабораторная', `count_hours`, 0))) as total_hours -- исправление здесь
FROM
`list`
GROUP BY
`class`,
`discipline`;
or so:SELECT *
, (`lection` + `seminar` + `lab`) as total_hours FROM
(SELECT `class`, `discipline`,
SUM(IF(`type`='Лабораторная', `count_students`, 0)) AS `count_students`,
SUM(IF(`type`='Лекция', `count_hours`, 0)) AS `lection`,
SUM(IF(`type`='Семинар', `count_hours`, 0)) AS `seminar`,
SUM(IF(`type`='Лабораторная', `count_hours`, 0)) AS `lab`,
SUM(`type`='Лекция') AS `groups`,
SUM(`type`='Лабораторная') AS `subgroups`,
count('id') AS `numbe`,
`course_semestr`, `profile`, `id`
FROM
`list`
GROUP BY
`class`,
`discipline`);
And the report generators are all looking for information.P.S. Sorry, he misunderstood the question, and accordingly gave the wrong answer, the decision gives the sum of three columns, not the total for each, the right answer for @Alex to use ROLLUP