2
我想實現與Zend框架2選擇對象這樣的語句:如何使用select對象從派生表中進行查詢?
select count(*) as total from (select id from table group by name) a;
我的代碼是:
$sub = $adapter->select()->from('table')->group('name');
$sql = $adapter->select()
->columns('total'->new Expression('count(*)'))
->from(array('a'=>$sub));
當我執行查詢,瀏覽器總是告訴我,「$表必須是一個字符串,數組或TableIdentifier的實例'。
感謝您的幫助!