Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function init()
- {
- $games = new Application_Model_DbTable_Game();
- // first construct the subquery/join for the IN clause
- // SELECT idGameType FROM GameType HERE nameGameType = 'Xbox'
- $subselect = $games->select()
- ->from('GameType', array('idGameType'))
- ->where('nameGameType = ?', 'Xbox');
- // construct the primary select
- // SELECT titleGame FROM Game WHERE idGameType IN (subquery)
- $select = $games->select()
- ->setIntegrityCheck(false) // allows us to select from another table
- ->from($games, array('titleGame'))
- ->where('idGameType IN (?)', $subselect);
- $this->view->games = $select->query()->fetchAll();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement