$levelsql =$this->db->query("SELECT pro_id,pro_xp,pro_label
FROM
(
SELECT *,
(
SELECT SUM(pro_xp)
FROM tbl_program
WHERE pro_xp <= t.pro_xp
) total
FROM tbl_program t
) q
WHERE total <= $ProfileXp
ORDER BY pro_xp desc");
我使用CI函数编写了此查询,但希望以Active记录方式编写。