Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Average query
fabien23
March 2012
Hi How can I write a query with the avg sql function ? here is my query : (average on scores.score)
DB::select('scores.game_id','games.titre')->from('scores')->where('scores.user_id','=',$user_id);
fabien23
March 2012
Found it : $expression = DB::expr('AVG(scores.score)');
DB::select(array($expression,'average'),'scores.game_id','games.titre') ...
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
fabien23
March 2012