2009年9月29日星期二

Re: [fw-db] Support Zend_Db_Select sub selects ?

You should be able to do that if you wrap your subselect in a Zend_Db_Expr object. Try this:

$subSelect = $db->select()
->from('aktualne', array('n' => 'name'));

$subSelectString = '(' . $subSelect->__toString() . ')';

$select = $db->select()
->from(
    array('akt' => new Zend_Db_Expr($subSelectString)),
    array('n')
)
->where('akt.n = ?', 2008);

$db->fetchAll($select);

--
Hector


2009/9/29 sNop <snop3@seznam.cz>
Hi,

something like this:
SELECT `akt`.`n`
FROM (
 SELECT `name` AS `n`
 FROM `aktualne`
) AS `akt`
WHERE `akt`.`n` = '2008'

Support this Zend_Db_Select ?

Thank for any suggestions.


没有评论: