Codeigniter $this->db->select() не работает с Round(Max()) или FORMAT(MAX()) [закрыто]Php

Кемеровские программисты php общаются здесь
Anonymous
Codeigniter $this->db->select() не работает с Round(Max()) или FORMAT(MAX()) [закрыто]

Сообщение Anonymous »

Я пишу следующий код

Код: Выделить всё

$this->db->select('SUM(qty) as total_qty,(FORMAT(SUM(amount),2)) as total_amount');
$this->db->where('Invoice_Rec_No',$Invoice_Rec_No);
$result=$this->db->get($this->invoice_products_tbl);
$total_data=$result->row();
но получаю ошибку

Код: Выделить всё

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM (tbl_invoice_products) WHERE Invoice_Rec_No = 7' at line 2

SELECT SUM(qty) as total_qty, (FORMAT(SUM(amount), 2)) as total_amount FROM (tbl_invoice_products) WHERE Invoice_Rec_No = 7

Filename: C:\wamp\www\admin_followme247_master\system\database\DB_driver.php
Я хочу выполнить этот запрос с помощью codeigniter ActiveRecord.

Подробнее здесь: https://stackoverflow.com/questions/238 ... -formatmax

Вернуться в «Php»