Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM Get SUM column
Can you help me to Get a SUM of a column
$stock->entered_stock = Model_Admittance::select('SUM(`quantity`)')->where('phone','=',$admittance->phone)->get('quantity');
The ORM isn't really designed to run custom selects, it requires a mapping with the columns defined in the model, and the presence of the primary key in all results, to work.
There is experimental support for DB::expr() in selects in 1.8/develop, but yours will not work, as for a SUM() you will never have a primary key in the result.
Use DB::select() instead.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion