create table orders (
id int,
name varchar(255)
);
create table order_product (
id int,
order_id int references orders(id),
importance tinyint
);
insert into orders values (1, 'Order1'), (2, 'Order2');
insert into order_product values
(1, 1, 0), (2, 1, 0),
(3, 1, 1), (4, 1, 1);
select * from orders
where exists (select 1 from order_product where order_id = orders.id and importance = 0);