php - Zend 1 - SQL FROM expression alias -



php - Zend 1 - SQL FROM expression alias -

i'm performing sub-select in from clause of query. sub-select beingness passed query zend_db_expr it's supposed be, can't seem alias sub-select.

example:

$a = $adapter->select()->order('abc.id desc'); $b = $adapter->select()->from('b'); $a->from(new zend_db_expr("($b) xxx", 'xxx.id'); // not work - aliases "t"

the reason why alias 't' comes next line: https://github.com/zendframework/zf1/blob/master/library/zend/db/select.php#l787

any ideas? thanks!

you can give own aliases that:

$a = $adapter->select()->order('abc.id desc'); $b = $adapter->select()->from('b'); $a->from(array('xxx'=>$b), 'id');

which results in: select `xxx`.`id` (select `b`.* `b`) `xxx` order `abc`.`id` desc

php mysql zend-framework

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -