'Simple select records from two tables

I have 2 tables (table_A has one column products_id & table_B has products_id & state) My query needs to select, all products_id from table_A join with table_B except these products_id that have state = open. i tried bellow but it displays records from table_B records only

SELECT * FROM table_A WHERE EXISTS (SELECT product_id, state FROM table_B WHERE table_A.product_id = e_productBAK1FEB.product_id AND state == 'open'



Solution 1:[1]

Try

select table_A.* from table_A 
join table_B on table_A.product_id = table_B.product_id
where table_B.state != 'open'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1