0
select A.`Product#`,
a. ` Email Address`
FROM
Table a A, `Table b B
where A.`Product#`<> B.`Product#`

I am trying to compare if Table B's product# exists in Table A or not, this query does not give 100 % result.

Please tell me what is wrong in this query.

1 Answers1

0

You should use a NOT EXISTS query

select *
FROM
Table b B
where not exists ( select 1 from table a A where A.`Product#`= B.`Product#`)

This will show you all that exists in table B that does not exist in table A which is what I believe you were asking in your question. Can be reversed to show what's in table A that is not in table B.

Zynon Putney II
  • 675
  • 4
  • 12
  • want to find out what product# of table B is not in table A. So it will be marked as new Product# in warehouse. –  Dec 31 '19 at 19:26