In table I have pirce in different currencies - USD/Euro
Pure MySQL I can do:
SELECT id, price, currency_id, title,
CASE currency_id
WHEN 1
THEN price
WHEN 2
THEN price * 1.34
END AS cost_usd
FROM dec_immovables
WHERE 1
ORDER BY cost_usd DESC
LIMIT 0 , 30
This construction:
$this->paginate = array('limit' => 10,array('fields' => array
('id','title','price','currency_id','country_id',"CASE currency_id
WHEN 1 THEN price WHEN 2 THEN price * 1.34 END AS cost_usd"),'order'
=> array('cost_usd' => 'DESC')));
doesn't work.
How to make it beauty?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---