select campaign,lead_status,COUNT(id)
from buyers
where lead_status IN('Very Hot','Hot', 'Warm', 'Cold', 'Not Contacted')
and campaign IN('stage1','stage2','stage3','stage4') and created_on >='2012-10-01'
and is_put_for_exchange='0' and transaction_type='First Sale'
and propertytype='Residential'
group by campaign,lead_status
ORDER BY campaign asc, field(lead_status,'Very Hot','Hot', 'Warm', 'Cold', 'Not Contacted')
convert in cakephp Syntax plz It Argent?
Try this
For reference to others, this query will be look like this if we convert into CakePHP method
You can modify your raw SQL into CakePHP format by going through the documentation.
Or for any reason you cannot / will not, then you can use the raw SQL query as follows:
In controller:
In model:
Documentation of
query()