Hello, I have a question about Zend_Db_Select:
My question, does Zend_Db_Select have an option to where you can add an AND NOT clause like so.
SELECT COUNT(shift_id) as total FROM location_shifts WHERE location_id = '1' AND label = 'N1 SL' AND NOT shift_id = '5'
I currently have the select query setup like this.
$select = $this->select();
$select->from($this->_name, array('total' => new Zend_Db_Expr('COUNT(shift_id)')))
->where('label = ?', $label);
if ($locationID)
$select->where('location_id = ?', $locationID);
if ($shiftID)
$select->Where('shift_id = ?', $shiftID);
$select->limit(1);
And this is the generated output
SELECT COUNT(shift_id) AS `total` FROM `location_shifts` WHERE (label = 'N1 SL') AND (location_id = 1) AND (shift_id = 5) LIMIT 1
Thank you for your time in advanced
f
没有评论:
发表评论