We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

PHQL - DELETE and LEFT JOIN

It is possible to use LEFT JOIN in DELETE statments? I would like delete only rows from ModelA

Example like this produce error:

DELETE  ModelA.* FROM
LEFT JOIN ModelB ON ModelA.id = ModelB.model_a_id 
WHERE ModelB.id > 100 AND ModelA.id > 100

This is correct way? I have more complicated statment in real query, so maybe the problem lies somewhere else.



2.9k

DELETE ModelA.* FROM ModelA LEFT JOIN ModelB ON ModelA.id = ModelB.model_a_id WHERE ModelB.id > 100 AND ModelA.id > 100