Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在codeigniter中转换_Php_Mysql_Sql_Codeigniter - Fatal编程技术网

Php 如何在codeigniter中转换

Php 如何在codeigniter中转换,php,mysql,sql,codeigniter,Php,Mysql,Sql,Codeigniter,您可以尝试此Codeigniter活动查询: 查询: SELECT sum(`quantity`) as 'Total Product Sales',product.i_name as 'Product Name' FROM `order_details` inner join orders on orders.order_id = order_details.order_id and orders.status like 'C' inner join product on product

您可以尝试此Codeigniter活动查询:

查询:

SELECT sum(`quantity`) as 'Total Product Sales',product.i_name as 'Product Name' 
FROM `order_details` 
inner join orders on orders.order_id = order_details.order_id and orders.status like 'C' 
inner join product on product.p_id = order_details.product_id 
group by order_details.product_id

我希望它能有所帮助。

按照查询生成器的说明进行操作
public function get_data(){
        $this->db->select("sum(order_details.quantity) as total_product_sales", FALSE);
        $this->db->select("product.i_name as product_name'", FALSE);
        $this->db->from('order_details');
        $this->db->join('orders', 'orders.order_id = order_details.order_id','INNER');
        $this->db->join('product', 'product.p_id = order_details.product_id', 'INNER');
        $this->db->like('orders.status', 'C');
        $query_result = $this->db->get();
        $result = $query_result->result();
        return $result;
    }