i have this query:
SELECT
a.nombre,
a.apellidos,
p.nombre AS prueba,
IF(r.puntuacion IS NULL, 0, 1) AS prueba_realizada,
r.puntuacion,
r.id
FROM alumnos a
LEFT JOIN resultados r ON r.alumno_id = a.id
RIGHT JOIN pruebas p ON p.id = r.prueba_id
And i have this result:
I need to get the "nombre" and "apellidos" field in the RIGHT JOIN result from the "alumnos" table, because the goal for the query is to get all the "pruebas" that the user has not done and those it has already done ...
What i am doing wrong?
Here is the db schema
This is the expected result