I would like to create a sql query in Zend Framework in the Abstract.php or in model? but I have a hard time figure out how to do it. I am new in zend framework.
The query that I want to create looks like that:
delete from users where id not in(select * from(select min(n.id)from users n group by n.email)x);
But in zend:
$results = $db->query('delete
from users
where id not in(
select * from(
min(n.id)
from users n
group by n.email
)x)');
Look like the $db got a undefined variable, what kind of database function should the db call? My database is being call in the application.ini
select()todelete(), but you'd want to learn PHP and read the documentation before you go doing destructive changes to data like that.