I have the sql code and i want to do in cake php but i dont know how and i don’t want to do it like that
$obj->query($sql);
This is my query:
"SELECT dbfiles.amount, MONTHNAME(cases.enquiry_date) as Month FROM cases INNER JOIN services ON cases.id = services.case_id INNER JOIN dbfiles ON services.id = dbfiles.service_id WHERE cases.status = 2 AND YEAR(cases.enquiry_date) = '2012' AND dbfiles.type = 'INV' AND cases.currency = 'EUR' GROUP BY dbfiles.invoice_num ORDER BY Month DESC; "
Assuming $obj is of class
Case