3
我嘗試使用Zend_Db_Select在FROM部分中使用子查詢構建查詢。進出口尋找財產以後這樣的:Zend Db選擇添加子查詢到FROM部分
SELECT COUNT(row_1) AS count_row FROM (SELECT row,row2,... FROM table WHERE row= ...) AS temp WHERE row = 0)
所以我嘗試做這樣的:
$oSubSelect =
$this->select()
->setIntegrityCheck(false)
->from('table',
array(
'row_id'
)
)
->where(PRFX.'table.id = '.PRFX.'table2.id')
->from(PRFX.'table2',array('row','row2'));
$this->select(false)
->setIntegrityCheck(false)
->from(new Zend_Db_Expr($oSubSelect).' AS temp',
array(
'COUNT(row_id) AS row_count',
)
);
但是這給了我一個錯誤信息。 此致敬禮。