Hi There,

I think what Sushil is asking is a bit different. In general terms,
how can you make use of in-build MySQL functions in Criteria object.
E.g: if you want to compare the value of a column in where clause of a
query with YEARWEEK(curdate()) and at the same time run the same
function of the column itself, does Criteria or Criterion provide a
way to achieve this?

e.g: select * from product where YEARWEEK(track_date) =
YEARWEEK(curdate()). How can you write this query using Criteria
Object?

Snehal



On Apr 5, 9:27 pm, "Muhammad Asif Ali" <[EMAIL PROTECTED]> wrote:
> Hi...
> Query objects between two dates with Criteria
> Say you look for the objects of class Foo being created between $from_date 
> and $to_date. This should do the trick:
>
> $c = new Criteria();
> $criterion = $c->getNewCriterion(FooPeer::CREATED_AT , date('Y-m-d', 
> $from_date), Criteria::GREATER_EQUAL  );
> $criterion->addAnd($c->getNewCriterion(FooPeer::CREATED_AT , date('Y-m-d', 
> $to_date), Criteria::LESS_EQUAL ));
> $c->add($criterion);
> $shows = FooPeer::doSelect($c);This is the code from Snippetsso plz check the 
> snippet for more code.Thank youRegardsMohammad Asif ali


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to