You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Prashant Punekar <Pr...@mindtree.com> on 2010/10/21 03:24:35 UTC

generate complicated query using entity engine !

Hi,

Has anyone used "case when" statement  using entity engine ?
Here is the query which I want to generate using the entity engine .....

********************************************************************************
Update velocity_retailer_counter
Set         total$ = CASE
      WHEN HOUR(TIMEDIFF(NOW(),Last_Update_Date)) > Period_Hours THEN Txn.Value
       ELSE (total$ + Txn.Value)
END CASE
                ,Total_Txns =  CASE
      WHEN HOUR(TIMEDIFF(NOW(),Last_Update_Date)) > Period_Hours THEN 1
                      ELSE (total_txns + 1)
END CASE

Where RetailerID = Txn.RetailerID

********************************************************************************

Regards,
Prashant

________________________________
http://www.mindtree.com/email/disclaimer.html