如何将此sql查询写入codeigniter查询

o4hqfura  于 2023-01-18  发布在  其他
关注(0)|答案(1)|浏览(133)

SELECT 1 +(SELECT count(*)FROM学生排名a WHERE a.获得的总分数〉b.获得的总分数)AS排名FROM学生排名b WHERE学生标识= '5' ORDER BY排名LIMIT 1 ;
转换搜索查询

lb3vh1jj

lb3vh1jj1#

使用

$this->db->query("SELECT 1 + (SELECT count( * ) FROM student_rank a WHERE a.obtained_total_mark > b.obtained_total_mark ) AS rank FROM student_rank b WHERE student_id = '5' ORDER BY rank LIMIT 1")

相关问题