I have the tables Matieres
and Resultats
___ Matieres ___ ___ Resultats ___
id (int auto increment) ID (int auto_increment)
Nom (varchar) TIME_OF_INSERTION (datetime current_timestamp)
Categorie (varchar) ID_USER (int)
Active (boolean) ID_MATIERE (int)
RESULTAT (int)
And i have this request:
SELECT * FROM Matieres LEFT JOIN Resultats ON Matieres.id = Resultats.ID_MATIERE AND Resultats.ID_USER = :userid WHERE Active = TRUE AND ID_Formation = :formation)
The problem is that it returns me every resultats the user inserted in the table Resultats, for each Matieres. When i just want the last one inserted for each Matieres.Nom
... :/
I tried with GROUP BY TIME_OF_INSERTION
but it won't work :(