Reputation: 1279
I have an Android application with SQLite database, where I display search results for user input.
I have 2 tables, both have the same columns, but one is used for user's custom data.
When user searches for something, I would like to display UNIQUE results from both tables together.
How would I do that? Is it possible to use JOIN
? Or should I query each table separately and then join the Cursors
?
Tables:
_id a b c
---------------
1 data data 3
2 data data 10
3 data data 1
and
_id a b c
---------------
1 data data 10
2 data data 6
3 data data 1
Upvotes: 0
Views: 67
Reputation: 6179
Make a Union into the two tables
SELECT a,b,c
FROM table1
[WHERE condition]
UNION
SELECT a,b,c
FROM table2
[WHERE condition]
Upvotes: 1