This is the condition I want to display:
AND `Grant`.`date` BETWEEN
DATE_SUB('2006-01-01',INTERVAL `Grant`.`term` MONTH) AND
'2005-12-31'
This comes really close:
$cond['and'] = array(
"Grant.date BETWEEN ? AND ?" => array(
"DATE_SUB('2007-01-01',INTERVAL `Grant`.`term` MONTH)',
'2006-12-31')
);
However the query that Cake generates automatically puts quotes around
each argument in the BETWEEN clause, so the query that Cake produces
is:
AND `Grant`.`date` BETWEEN
'DATE_SUB('2006-01-01',INTERVAL `Grant`.`term` MONTH)' AND
'2005-12-31'
This latter one does not work, because the DATE_SUB function has
single quotes around it, which prevents the date math from being done.
Is there any way to set up a query like this this without hand-coding
the query?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---