0
這是我笨查詢MySQL查詢優化和更新需要
$this->db->select('o.*,seo.price as seo_price,SUM(domain.price) as domain_price,SUM(bes.price) as bes_price, SUM(op.price) as payment_price');
$this->db->from('order as o');
$this->db->join("order_package_seo as seo", "seo.order_id = o.id", "left");
$this->db->join("order_package_domain as domain", "domain.order_id = o.id", "left");
$this->db->join("order_package_bespoke as bes", "bes.order_id = o.id", "left");
$this->db->join("order_payment as op", "op.order_id = o.id", "left");
$this->db->where("o.id" , $id);
$query = $this->db->get();
return $query->row();
我有3條在「order_package_beskope」表和其他1所有 我想擺脫所有的表價格ORDER_ID 被我需要使用group_by獨特或任何其他方法需要你的建議。
確定,所以什麼是它返回.. –
它返回所有的價格多由3添加組。即域名價格是123,但其返回369. –
我可以解釋更多,如果你可以幫助.. –