我有一个场景如下。
我有五个表:merchants
,user_details
,user_role
,transient_payments
和payments
。
要求:如果transient_payments和payment表中不存在merchant_id,则该商家应从merchants
,user_details
,user_role
我的查询:
DELETE FROM m,ud,ur USING merchants
INNER JOIN user_details
INNER JOIN user_role
where merchant_id not
exists (select *
from transient_payments
full join payments
on transient_payments.merchant_id = payments.merchant_id );
Error :ERROR: syntax error at or near "," LINE 1: DELETE FROM m,ud,ur USING merchants INNER JOIN user_details ... ^ ********** Error ********** ERROR: syntax error at or near "," SQL state: 42601 Character: 14