jeudi 11 juin 2015

Select records from a table, which don't exist in another table

I have 2 tables TABLE1 and TABLE2 in sqlite DB. TABLE 2 has some of the records of the TABLE1. What I want is to select all the records from TABLE 1, which don't exist in TABLE2. So I coded:

String sq = "SELECT TABLE1.name, TABLE1.surname, TABLE1.id FROM TABLE1"
            + "LEFT JOIN SHIFTS "
            + "ON TABLE1.id <> TABLE2.id";

However this query returns something that i don't get it.. Which is the right query?

Aucun commentaire:

Enregistrer un commentaire