I'm new to ORACLE and I'm trying to use a string aggregation function in my query to concatenate the value of rows with a comma
this is the structure of my tables:
description column indicates the name of the course for example Algebra or Math. Nomreh column shows the Mark each student achieved in each course (it's a Persian word).
This is my query
Select s.student_name , LISTAGG(c.description, ',') WITHIN GROUP (ORDER BY c.description) AS Courses, LISTAGG(sc.nomreh, ',') WITHIN GROUP (ORDER BY sc.nomreh) AS Ranks from student s inner join student_course sc on s.student_id = sc.student_id inner join course c on sc.course_id = c.course_no group by s.student_name
I want the output to show:
[Student-name] [Course-Description] [Nomre] Artin Algebra,Math,Sport 10,11,12
each value in
[Nomreh] column should be exactly for that
[Course] column and for that specific student . Unfortunately my query does not give the desired output and the values in Nomreh column are not in correct order with [Course-Description] column.