你好我有查詢,我必須申請和條件加入地方,但我不知道如何在zend做到這一點。請幫忙。申請AND條件在加入Zend框架
$dbA = $this->dbAdapter;
$sql = new Sql($dbA);
$select = $sql->select()->from(array('answer' => 'tblanswer'));
$select->columns($fetch);
$select->join(array('fixed' => 'tblfixanswer'), 'fixed.aid = answer.aid', array(), 'left');
$selectString = $sql->getSqlStringForSqlObject($select);
$results = $dbA->query($selectString, $dbA::QUERY_MODE_EXECUTE);
所需出需要的是:
SELECT *
FROM `tblanswer` AS `answer`
LEFT JOIN `tblfixanswer` AS `fixed` ON `fixed`.`aid` = `answer`.`aid` and fixed.baid=27
值27由可變的到來。
謝謝Ronak,我已經申請的方式,但值27由可變來得這麼表示喜歡這樣的報價:AND fixed.baid = '27' –