Active record order_by the result of multiplying two fields |
$this->db->order_by("project_units.price_min * rate", "asc");
From the 3.0 User Guide "Lets you set an ORDER BY clause. The first parameter contains the name of the column you would like to order by. The second parameter lets you set the direction of the result. Options are ASC, DESC AND RANDOM." Use the field name itself, not the computed value. $this->db->order_by("project_units.price_min", "asc");
CI 3.1 Kubuntu 19.04 Apache 5.x Mysql 5.x PHP 5.x PHP 7.x
Remember: Obfuscation is a bad thing. Clarity is desirable over Brevity every time. |
Messages In This Thread |
Active record order_by the result of multiplying two fields - by andycansdale - 11-18-2014, 04:24 PM
RE: Active record order_by the result of multiplying two fields - by twpmarketing - 11-18-2014, 04:38 PM
RE: Active record order_by the result of multiplying two fields - by andycansdale - 11-18-2014, 04:45 PM
RE: Active record order_by the result of multiplying two fields - by andycansdale - 11-18-2014, 04:54 PM
RE: Active record order_by the result of multiplying two fields - by bclinton - 11-18-2014, 05:13 PM
RE: Active record order_by the result of multiplying two fields - by andycansdale - 11-18-2014, 05:22 PM
RE: Active record order_by the result of multiplying two fields - by andycansdale - 11-18-2014, 06:28 PM
RE: Active record order_by the result of multiplying two fields - by bclinton - 11-18-2014, 06:33 PM
RE: Active record order_by the result of multiplying two fields - by andycansdale - 11-18-2014, 06:39 PM
|