mercredi 20 juillet 2016

MySql SELECT query with LEFT JOIN falsely returns NULL

I'm trying to get values out of 2 tables in my DB, I used the following code:

    SELECT t1.name, t1.lname, t1.id, t2.grade 
    FROM users as t1 
    LEFT JOIN grades as t2
    ON t1.id = t2.userid and t2.choreid= '7';

It returns good values for : t1.name, t1.lname, t1.id

but where it comes to t2.grade instead of '100' or '50' it always returns NULL.

can anyone see why ?

Aucun commentaire:

Enregistrer un commentaire