zend-db-select

change a complicated query to Zend_Db_Select object.

I have a query which is a little complicated: (SELECT category_id AS id, content_title AS title, content AS detail, 'content' AS type FROM category_content WHERE $where ORDER BY id DESC) UNION (SELECT news_id AS id, news_title AS title, news_detail AS detail, 'news' AS type FROM news WHERE $where ORDER BY id DESC) How can i chan...

Count on Zend_Db_Select

Say I have a random zend_db_select object. How can I perform a count on that object, so I know the amount of items that meet the query. I tried the following: $data->TotalRecords = $select->columns(new Zend_Db_Expr('COUNT(*)'))->query()->fetch(); But this gives me the following error: Message: No table has been specifiedfor the ...

Zend DB Select nested Joins

I'm trying to realize the following query with zend db select: SELECT `uac`.`uid`, `u`.`uid`, `g`.`groupid`, `g`.`packageid` FROM `user_has_data` AS `uac` INNER JOIN `users` AS `u` ON u.uid = uac.uid LEFT JOIN (`user_in_group` AS `uig` INNER JOIN `groups` AS `ag` ON (ag.groupid = uig.groupid) AND (ag.packageid = 2) ) AS `g` ON u...

When to use which Zend_Db class? Zend_Db_Select vs. Zend_Db_Table_Abstract

I think it's possible to write select queries with either Zend_Db_Select or Zend_Db_Table_Abstract, but I don't understand when to use which of the two. Is one more optimized for something than the other? Are joins "easier" with one or the other? Thanks! ...