There is a database with several tables: groups (id, name) , students (id, name, surname, gr_id) , marks (id, st_id, d_id, t_id, mark) .
It is necessary to calculate the number of groups that are rated. Swears about the syntax near FROM marks) AS :
SELECT COUNT(DISTINCT groups.id) FROM groups JOIN students JOIN (SELECT DISTINCT st_id FROM marks) AS der_table ON (groups.id = students.gr_id AND students.id = der_table.st_id); Help, please, I want to understand this question.
JOIN students ON groups.id = students.gr_id JOIN (SELECT DISTINCT st_id FROM marks) AS der_table ON students.id = der_table.st_idis at least - Alexey Shimansky