MySQL Forums
Forum List  »  Newbie

Re: get table sorted
Posted by: danish hafeez
Date: February 19, 2024 12:40AM

To sort the table produced by your query by the columns id, exam, and question, you can simply add an ORDER BY clause at the end of your query. Here's the modified version of your query:

SELECT * FROM responses ORDER BY id, exam, question
) a
SELECT MAX(exam) AS maxexam FROM responses
) b
ON a.exam <= b.maxexam
AND > 2
ORDER BY, a.exam, a.question;

This will sort the result set first by id, then by exam, and finally by question.

Options: ReplyQuote

Written By
February 18, 2024 07:24PM
Re: get table sorted
February 19, 2024 12:40AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.