[DC-646] DELETE and INNER JOIN Created: 23/Apr/10 Updated: 03/Jun/13 Resolved: 08/Jun/10
|Reporter:||jerome||Assignee:||Jonathan H. Wage|
I made a DQL delete query.
$q = Doctrine_Query::create()
//GENERATED SQL OF THE DQL
But this query is incorrect
The query must be( alias are not present beetween DELETE and FROM and for the FROM table)
DELETE tr FROM term_relationship tr INNER JOIN term_taxonomy t2 ON tr.term_taxonomy_id = t2.id INNER JOIN post p ON tr.object_id = p.id WHERE (p.id = '1' AND t2.taxonomy = 'category')
With this request all is good in pphmyadmin.
|Comment by Jonathan H. Wage [ 08/Jun/10 ]|
Joins are not supported on update and delete queries because it is not supported on all dbms. It won't be implemented in Doctrine 1 or Doctrine 2. You can however get the same affect by using subqueries.
|Comment by James Bench [ 03/Jun/13 ]|
You can't delete from a table when it's in a subquery in MySQL (I'm using Doctrine 2).