sql - how would i get it to show me records in one table that arent present in another table using an EQUI JOIN? -


select c.customerno, name, telephone, address, postcode customer c, carforsale s not (c.customerno=s.customerno); 

so i'm meant produce output shows customers not have record in car sale table. thought of putting in not in clause essentialy bring ones arent there it's bringing whole table back.

a simple rule: never use commas in from clause. actually, there slight modification ms access, because not support cross join. so, use commas when intend cross join.

you cannot want inner join. can use left join, still equi-join:

select c.customerno, name, telephone, address, postcode customer c left join      carforsale s      on c.customerno = s.customerno s.customerno null; 

a left join keeps rows in first table, when on clause not true. where clause chooses rows have no match.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -