SELECT *, SUM(`Relaxation_rating` + `Food_rating`) AS Ratings
GROUP BY CODE
ORDER BY Ratings DESC
FROM destinations
如何在 CodeIgniter 中将此 sql 代码转换为 CctiveRecord?
我尝试了以下方法,但它确实显示了任何结果。
$this->db->select("'(SELECT *, SUM(Relaxation_rating + Food_rating) FROM database GROUP BY CODE') AS Ratings", FALSE);
$this->db->get("database");