There are 2 tables in MySQL .

the first

id 1 2 3 4 и т.д. 

The second

 product_id 2 4 и т.д. 

If the id from one table and product_id from the second, then this id should not be included in the selection from the first table.

    1 answer 1

     SELECT * FROM table_a a -- Выбираем все из table_a LEFT JOIN products p -- Ищем соответствующую строку в products ON a.id = p.product_id -- (но не выкидываем строки table_a без соответствия) WHERE p.product_id is null -- Оставляем только строки без соответствующего продукта. 

    In general, there are three options: JOIN vs NOT EXISTS vs NOT IN, slightly different in semantics, as well as in performance.