Search code examples
sqlsqlitecursor

Show value not existing in another table SQLite


I want to show the value in EXTRA_CALL that not exist in TBL_CALLPLAN. I have query is:

Cursor c = db.rawQuery("select a.CODE, a.NAME from EXTRA_CALL a LEFT JOIN TBL_CALLPLAN b ON b.CCODE=a.CODE " +
                "WHERE b.CCODE IS NULL", null);

when i run that query, the value always show all in EXTRA_CALL table. Where is my fault?


Solution

  • this query make my problem solve:

        Cursor c = db.rawQuery("select a.CODE, a.NAME from EXTRA_CALL a where " +
                "not a.code in (select ccode from tbl_callplan) order by a.custname asc", null);