DELETE B.*
FROM m_productprice B
INNER JOIN m_product C ON B.m_product_id = C.m_product_id
WHERE C.upc = '7094' AND B.m_pricelist_version_id = '1000020'
i am getting the following error PostgreSQL 8.2.11
ERROR: syntax error at or near "B"
LINE 1: DELETE B.* from m_productprice B INNER JOIN m_product C ON ...
i tried giving
DELETE B from m_productprice B INNER JOIN m_product C ON B....
ERROR: syntax error at or near "B"
i tried giving
ERROR: syntax error at or near "INNER"
LINE 1: DELETE from m_productprice B INNER JOIN m_product C ON B.m_...
what is the problem with my query?
INNER JOIN
available for the DELETE statement: postgresql.org/docs/8.2/static/sql-delete.htmlJOIN
withDELETE
. It suggests using their alternative non-standardUSING
syntax and otherwise suggests aWHERE
but it does not mention anywhere thatJOIN
is not supported. Given that JOINs in DELETE clauses are allowed in MySQL and SQL Server, Postgres is the odd one out. Maybe they have their reasons, but they should be explicit postgresql.org/docs/8.2/sql-delete.htmlUSING
option is just as non-standard as theJOIN
option MySQL and SQL Server use. Neither of them defines the "standard" and e.g. Oracle and DB2 have not option at all to "join" other tables