Я хотел бы перевести этот запрос MySQL в формат Zend:
SELECT count_panne, mvt, nextHost, dtmvt, stat
FROM ( SELECT COUNT(myTable.snMCB) AS count_panne,
myTable.mvt,
myTable.nextHost,
myTable.dtmvt,
myTable.stat
FROM myDB.myTable myTable
WHERE (myTable.dtmvt = calendar__gregorian__today__)
AND (myTable.statut = 'NOOK')
GROUP BY myTable.snMCB) AS myTempTable
WHERE count_panne > 2
ORDER BY count_panne DESC
(ps: это правильное предложение mysql с модификациями)
Я попробовал следующее с Zend:
$subSelect = $dbTable->select()
->from($dbTable,array(
'COUNT(myTable.snMCB) AS count_panne',
'myTable.mvt',
'myTable.nextHost',
'myTable.dtmvt',
'myTable.nextHost'))
->where("myTable.dtmvt BETWEEN '$dateDeb' AND '$dateFin'")
->where('myTable.stat = ?', 'NOOK')
->group('myTable.snMCB')
;
$select = $dbTable->select()
->setIntegrityCheck(false)
->from(new Zend_Db_Expr($subSelect),
array('count_panne',
'mvt',
'nextHost',
'dtmvt',
'statut'))
->where('count_panne > 2')
->order('count_panne DESC')
;
Не сработало.