如何在codeigniter中使用临时表,比如更新列并获取结果?

i need a little help.

i am working with a module in codeigniter which deals with

$sql = "CREATE TEMPORARY TABLE `temp_user_rank` (
            `user_id` int(11) NOT NULL,
            `job_type` varchar(150) NOT NULL,
            `score` int(11) NOT NULL
            ) ENGINE=MyISAM AS ( SELECT `user_id`,`job_type` ,`score` FROM jh_user_profile WHERE user_id IN($result_users) )";

    $this->db->query($sql);

//after the insertion

I need to update the table score and then fetch the result user_id based on score using $this->db->query('select user_id FROM temp_user_rank') ;

I got the answer working with temporary table in codeigniter.

$this->db->query("DROP TABLE IF EXISTS temp_user_rank");
//passing the above sql here
$this->db->query($sql);
$result = $this->db->query('SELECT * FROM temp_user_rank')->result_array();

the result variable contains all results