Wazzzy Wazzzy - 1 year ago 79
MySQL Question

write delete query for following in zend framework

I am having a situation in my MySQL database table of row repeating

So I got this

DELETE from table1
USING table1, table1 as vtable
WHERE (NOT table1.ID=vtable.ID)
AND (table1.field_name=vtable.field_name)

is the table and
is a virtual table

How should I write that in Zend Framework

Answer Source

Zend_Db_Select supports the USING clause, but I think it's not supported by the Zend_Db_Adapter delete() method.

A possible alternative would be passing the SQL expression directly to the connection (if you are using the pdo_mysql adapter, it will be a PDO object):


(IMPORTANT: Make sure you quote properly all the identifiers and values in the SQL sentence, Zend_Db_Adapter has some extensive documentation about this).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download