zf2 \Zend\Db\Sql\Sql using predicate in where condition
Posted
by
RomanKonz
on Stack Overflow
See other posts from Stack Overflow
or by RomanKonz
Published on 2012-09-26T21:39:57Z
Indexed on
2012/10/07
3:38 UTC
Read the original article
Hit count: 464
i really don't get the point how to use predicates in zend framework 2.
this is what i got:
$sql->select()
->columns(array('GroupedColum'
,'minValue' => new Expression('min(ValueColumn)')))
->from('ValueTable')
->group('GroupedColum')
->order('minValue')
->order('GroupedColum')
->limit(10);
this is working fine
now i want to apply somethin like that:
$predicate = new Zend\Db\Sql\Predicate\Predicate();
$sql->where($predicate->greaterThan('filterColumn','20);
this is what i tried, it throws no error, but it is not working :-(
This is what i expect as SQL:
select GroupedColum
, min(ValueColumn) as minValue
from ValueTable
where filterColumn > 20
group by GroupedColum
order by minValue
GroupedColum
limit 10;
© Stack Overflow or respective owner