Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Select Query Builder
  • Hi everyone. I have some questions about mysql functions in query builder and etc.
    How to build SQL, like this for example:
    SELECT `a`.`row1`, (`a`.`row2` + `a`.`row3`) AS `TOTAL_SUM`, MAX(`a`.`row4`) as `MAX_VALUE` FROM `some_table` `a`;
    
  • I don't run this, sorry. But you can get idea. DB::select('a.row1',array(DB::expr('a.row2+a.row3'), 'TOTAL_SUM'), array(DB::expr('MAX(a.row4)'), 'MAX_VALUE'))->from(array('some_table', 'a'))->execute(); And read document: http://docs.fuelphp.com/classes/database/usage.html
  • Thanks, I skipped DB::expr method when read docs.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion