(SQL) perform Inner Join via conditional

1

I am trying to make a query of three tables in my MariaDB of a gym:

Clases
Instructores
Usuarios

What the query asks me is the following:

  

"Know which is the class that has more students and display" class ",   "Full name of the instructor" also including "names of the   students "".

I was able to perform the following deployment:

The query code I used:

select usuarios.Nombre, clases.Nombre_Clase, instructores.Nombre
from((clases
inner join usuarios on clases.Clase_ID = usuarios.Clases)
inner join instructores on clases.ID_instructor = instructores.ID);

But how can I deploy the class that has the most students? in this case that is the one of Box?

I'm not very good at database, but can you apply some kind of counter?

P.D. the last column on the right is that of instructors, the one on the left is of students.

    
asked by Maclos 03.05.2017 в 18:18
source

1 answer

0

I have resolved the Query, for those who have a similar situation:

select from usuarios.Nombre, clases.Nombre_Clase, instructores.Nombre
from((clases
inner join usuarios on clases.Clase_ID = usuarios.Clases)
inner join instructores on clasese_instructor = instructores.ID)
where usuarios.Clases = '1' ; //Número de clase

The result is the following:

Thanks gbianchi, for your support.

    
answered by 04.05.2017 в 01:24