I've got a query to select distinct results with two tables which returns email addresses that don't occur in table2
, but I'm having trouble also selecting data from the Table 2.First
in this query for all rows with distinct emails. Is it possible to combine select statements in SQLite/DBbrowser in this way? My current query with the syntax I've tried is below
TABLE1:
table1email | Firstlast |
---|---|
[email protected] | Jim Robinson |
[email protected] | Clark Stevenson |
TABLE2:
table2email | First | Last |
---|---|---|
[email protected] | Jim | Robinson |
[email protected] | Susan | Peters |
[email protected] | Clark | Stevenson |
QUERY:
SELECT table1email
FROM TABLE1
EXCEPT
SELECT DISTINCT table2email
SELECT First
FROM table2
The question doesn't seems to be very clear. Whatever I can understand from the question this seems to be the solution you are looking for.
This will work even if table2 have duplicate entries. But this will result duplicate entries from table1. If that is also needs to be eliminated, DISTINCT keyword can be used.