Hi
I have 2 databases which has same tablesnames and I need to list entries of a particular table in database1 not existing in the same tablename of database2.
eg : I have db1 which has table name orders
first_id | code | start | end | amountscore | id | amount_class |
+--------+--------+----------+----------+----------+--------------+--------------+
| 1 | ww | 935002 | 935100 | 245 | Ath | boeing |
| 1 | e | 4406486 | 4406628 | 575 | Lth | boeing |
| 1 | r | 30313484 | 30313585 | 348 | SSU | boeing |
| 18 | f | 44787276 | 44787468 | 1338 | SSU | boeing |
| 1 | g | 44787462 | 44787856 | 2775 | Ath | target |
| 1 | m | 44787855 | 44787944 | 747 | Ath | boeing |
| 1 | n | 53636773 | 53636856 | 549 | SSU | target |
| 1 | m | 53888147 | 53888282 | 695 | SSU | genev |
| 1 | q | 53888312 | 53888394 | 399 | Ath | boeing |
| 1 | c | 53888396 | 53888428 | 251 | Ath | geneva |
| 1 | f | 53888461 | 53888589 | 583 | gth | geneva
I only want to list those entries from table name orders in database 1 not present in same table name orders in database 2 .The only condition is I only want to list those entries whose amount_class ='boeing'
Therefore I am interested in those entries having amount_class = "boeing" in table (amount_class) of DB1 not present in same table name in DB2
I tried
Code:
select *
from (
select *
from DB1.orders
except
select *
from DB2.orders
) as amountclass
;
Am I missing something?