1
나는 선택 다음과 같습니다 젠드 DB 선택 "AND"문제
$select = self::getConnection()->select()
->setSqlCalcFoundRows(true)
->from(array('person' => parent::$_prefix . self::$_tableName), $rows)
->where($wherePerson['statement'], $wherePerson['value'])
->where($whereOwner['statement'], $whereOwner['value'])
->order($sort .' '. $sortDir)
->limit($limit, $offset);
지금 내가 추가
AND
을 추가 할 수 있습니다. 그러나 필드에 값이있는 경우에만 (사용자가 완료)
SELECT SQL_CALC_FOUND_ROWS xxx
FROM xxxx AS xxxx
WHERE (person_id = '305000270002')
AND (owner = '')
ORDER BY xxxx ASC
LIMIT 25
내가 필요하지 않습니다 및 비어있는 경우는 true, 그렇지 않은 경우는 내 결과가 잘못 : 소유자 필드가 비어있을 때 그래서, 내 쿼리의 결과 (는 AND 참조)하지 않을 수 있습니다. 그베이스 문을 생성하고 특정 조건에 어디에() 메소드에 의해 이상 연장 될 수
$select = self::getConnection()->select()
->setSqlCalcFoundRows(true)
->from(array('person' => parent::$_prefix . self::$_tableName), $rows)
->where($wherePerson['statement'], $wherePerson['value'])
->where($whereOwner['statement'], $whereOwner['value'])
->order($sort .' '. $sortDir)
->limit($limit, $offset);
if (false === empty($theFieldToCheck)) {
// add additional WHERE part if
// a field IS NOT empty
$select->where($additionalWherePart);
}
:
괜찮습니다. 감사합니다. – lander