I’m developing an Android 3.1 Tablet application which uses SQLite 3.
I have these three tables:
| Articles |
+-------------+
| articleId |
+-------------+
| description |
+-------------+
| OrdeArticle |
+-------------+
| orderId |
+-------------+
| articleId |
+-------------+
| EReportArticle |
+----------------+
| eReportId |
+----------------+
| articleId |
+----------------+
I want to select all articles which are on OrdeArticle table but they aren’t on EReportArticle table.
Here is my not working SQL sentence:
SELECT
Article.articleId,
Article.description
FROM
Article,
OrdeArticle,
EReportArticle
WHERE
OrdeArticle.orderId = ? AND
Article.articleId = OrdeArticle.articleId AND
EReportArticle.eReportId = ? AND
Article.articleId != EReportArticle.articleId;
What am I doing wrong?
Try using IN statement to check if articleId exists in one table and doesn’t in another