2
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語法plz It Argent?如何在cakephp中編寫SQL查詢?
相信我,它不會阻止SQL注入。 :( – Vineet
@Vineet你一定是在談論原始查詢,對嗎?因爲當使用CakePHP制定查詢時,它會清理等,以防止SQL注入。另外,對於原始查詢,請參閱_prepared statements_ at http://book.cakephp.org /2.0/en/models/retrieving-your-data.html#prepared-statements –
是的,我現在正在使用預先準備的語句。 – Vineet