我希望以CodeIgniter格式转换此查询。
SELECT image.image_id, image.image_name, category_name,
image.image_description, image.image, image.status, image.cdate, image.user_id
FROM tbl_image as image
left join tbl_imagecat category on image.category_id=category.category_id
where ( 1 AND image.status = 0 AND image.user_id in (0,0)) ORDER BY image.image_id
答案 0 :(得分:4)
$this->db->select("image.image_id, image.image_name, category_name, image.image_description, image.image, image.status, image.cdate, image.user_id");
$this->db->from("tbl_image as image");
$this->db->join("tbl_imagecat category", "image.category_id=category.category_id", "LEFT");
$this->db->where("image.status", "0");
$this->db->where_in("image.user_id", array("0") );
$this->db->order_by("image.image_id");
注意:我只是转换查询,我不关心你的逻辑。