0

My output to the question was this:-

FIRSTNAME  COURSENAME
---------- --------------------
Anand      C++
Bala       C++
Dileep     Linux and C
Gowri      Java
Gowri      Linux and C
Gowri      C#
John       C++
John       Oracle
Prem       Linux and C
Priya      Java
Priya      Oracle
Priya      C#
Rahul      Oracle

But the expected output is:-

FIRSTNAME  COURSENAME
---------- --------------------
Anand      C++
Bala       C++
Dileep     Linux and C
Gowri      C#
Gowri      Java
Gowri      Linux and C
John       C++
John       Oracle
Prem       Linux and C
Priya      C#
Priya      Java
Priya      Oracle
Rahul      Oracle

My code:

select firstname, coursename
from course
inner join
    (select student.firstname as firstname, registration.courseid
     from student
     inner join registration on student.studid = registration.studid
     group by student.firstname, registration.courseid) q1 on q1.courseid = course.courseid
order by firstname asc;

How do I arrange two columns in ascending order keeping the other fixed? (maybe I didn't sound good in explaining this)

1 Answers1

6
order by firstname, coursename 

Or

order by firstname asc, coursename asc