Answer the question
In order to leave comments, you need to log in
How to write a query in SQL database?
Knowledgeable people, please stop.
I volunteered to make the teachers' work easier and I can't do without your help!
The school has a database of marks, and it is necessary to generate a report for one subject . The data is not explicit and has to be collected piece by piece. The result should look like this: The Class
column is static and does not change values . The Number
column is the number of students. They helped me write the following query:
SELECT concat('<a target="_new" href="%%WWWROOT%%/course/view.php?id=',course.id,'">',course.fullname,'</a>') AS Course,
COUNT(course.id) AS Students
FROM prefix_role_assignments AS asg
JOIN prefix_context AS context ON asg.contextid = context.id AND context.contextlevel = 50
JOIN prefix_user AS USER ON USER.id = asg.userid
JOIN prefix_course AS course ON context.instanceid = course.id
WHERE asg.roleid = 5
AND course.fullname LIKE '%Қазақ тілі%'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question