sediq khan sediq khan - 6 months ago 30
SQL Question

Finding Non Matching ID

I have two tables, called "One" and "Two", they are both the same, table "One" has some IDs that are not there in Table "Two". but when i run this mysql Query, i can not get those non-matching values.

select count(bene) from one where bene not in (select bene from two);


And the result is Zero. so how do i get the non-matching values from Table one that are not there in table Two?

Answer
select count(*) from one a where not exists (select * from two b where a.bene=b.bene)