Home » Tag Archives: find records in one table that are not in another

Tag Archives: find records in one table that are not in another

SQL – find records from one table which don’t exist in another

company_services +----+------+--------------+ | id | name | company_id| +----+------+--------------+ | 1 | IT services| 102| +----+------+--------------+ | 2 | hardware| 105| +----+------+--------------+ company_products +----+------+--------------+ | id | title| company_id | +----+------+--------------+ | 1 | Mouse| 101| +----+------+--------------+ +----+------+--------------+ | 2 | Keyboard| 102| +----+------+--------------+ SELECT count(*)FROM company_services WHERE company_id NOT IN (SELECT company_id FROM company_products) Result Count=1 Related Queries select ...

Read More »