Reputation:
I'm trying to translate this query in a find, but without success. My find doesnt return anything.
My SQL (in postgresql)
select * from projectversion where project='10003' releasedate>=now()::date or releasedate is null
MY FIND
$projectversions = $this->find('list', array(
'recursive' => -1,
'fields' => array('vname'),
'conditions' => array('project' => $id_project,'releasedate >=now()::date','OR'=>array('releasedate is null'))));
Anyone can help me?
Upvotes: 0
Views: 72
Reputation: 4313
Your original SELECT doesn't appear to be valid:
select * from projectversion where project='10003' releasedate>=now()::date or releasedate is null
Should it be:
select * from projectversion where project='10003' AND (releasedate>=now()::date or releasedate is null)
If so, your conditions should look like:
'conditions'=>array(
'Model.project'=>10003,
OR=>array(
'Model.releasedate >= NOW()'
'Model.releasedate IS NULL'
)
)
produces:
WHERE Model.project = 10003 AND (Model.releasedate >= NOW() OR Model.releasedate IS NULL)
Upvotes: 1