gmc1103 Posted February 24, 2016 Share Posted February 24, 2016 Hi I'm trying to run a query but is not giving me the right values i need I need to run a query to have all classes ordered and the names of that classes ASC Example Class A have 20 students Class B have 18 So my query would have to give me A Names ASC B Names ASC etc This is what i have but with no success SELECT t1.`idstudent`, t1.`nome`, t1.`numero`, t1.`inscrito`, t1.`estado`, t1.`processo`, t2.`turma` FROM `esmaior_ca`.`alunos` AS t1 INNER JOIN `esmaior_ca`.`turma` AS t2 ON (t1.`turma_idturma` = t2.`idturma`) ORDER BY t2.`turma` AND t1.`nome` ASC; Any help? Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted February 24, 2016 Solution Share Posted February 24, 2016 Replace the AND in the ORDER BY with a comma ...ORDER BY t2.`turma` , t1.`nome` ASC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.