Puoi scriverlo usando NOT EXISTS
:
SELECT
id, client_id, buyer_id
FROM relation AS r
WHERE NOT EXISTS
( SELECT 1
FROM <some_table>
WHERE (r.client_id = <some_id> OR r.buyer_id = <some_id>)
AND ...
) ;
Puoi scriverlo usando NOT EXISTS
:
SELECT
id, client_id, buyer_id
FROM relation AS r
WHERE NOT EXISTS
( SELECT 1
FROM <some_table>
WHERE (r.client_id = <some_id> OR r.buyer_id = <some_id>)
AND ...
) ;