Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
run SUM function in DB
  • I want to run this SQL
    SELECT SUM(start_time - stop_time), job from timesheets GROUP BY job

    How can I perform it in FuelPHP?
    Thank you
  • HarroHarro
    Accepted Answer
    I would say:

    $result = \DB::select(\DB::expr("SUM(start_time - stop_time)"), 'job')
        ->from('timesheets')
        ->group_by('job')
        ->execute();

Howdy, Stranger!

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

In this Discussion