$this->db->select('movie_details.movie_id','movie_details.title','movie_details.producer','movie_details.director'.'movie_details.writer','GROUP_CONCAT(movie_genre.genre) As genre','movie_genre.movie_id');
$this->db->from('movie_details');
$this->db->join('movie_genre','movie_genre.movie_id=movie_details.movie_id');
$result=$this->db->get();
return $result->result_array();
我在普通的mysql中给出一个查询。但是我希望在codeigniter表单中进行此查询,因为我想学习codeigniter。
$query="select movie_details.movie_id,movie_details.title,movie_details.producer,movie_details.director,movie_details.writer,
GROUP_CONCAT(movie_genre.genre) As genre ,
movie_genre.movie_id
FROM
movie_details,
movie_genre
WHERE
movie_genre.movie_id=movie_details.movie_id
GROUP BY
movie_genre.movie_id limit 110,15";
答案 0 :(得分:1)
$this->db->select('movie_details.movie_id','movie_details.title','movie_details.producer','movie_details.director'.'movie_details.writer','GROUP_CONCAT(movie_genre.genre) As genre','movie_genre.movie_id');
//This is not right way to CI select.It will select only movie_id
使用此
$this->db->select('movie_details.movie_id , movie_details.title , movie_details.producer , movie_details.director , movie_details.writer , GROUP_CONCAT(movie_genre.genre) genre , movie_genre.movie_id');