我想這個MySQL查詢轉換爲Zend的格式:翻譯與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的句子modifs)
我跟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')
;
它沒有用。
如何,確切地說,沒有工作?始終準確地陳述您期望的和您實際獲得的內容,包括任何錯誤消息。 – outis