lundi 2 mai 2016

How to use case in laravel raw query

I want to select the row based on the current time in laravel.I have a query but it give a empty result.thanks in advance

$price_calc = DB::table('trip_price_fixing')
            ->select(DB::raw("DATE(D.datumTijd),
     CASE WHEN TIME(D.datumTijd) BETWEEN '08:00:00' AND '14:00:00' THEN 1
          WHEN TIME(D.datumTijd) BETWEEN '14:00:00' AND '20:00:00' THEN 2
          WHEN TIME(D.datumTijd) BETWEEN '20:00:00' AND '24:00:00' THEN 3
     END "));



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Oa8efP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire