6 months ago

Sum returns double value

Posted 6 months ago by atfinho

Hey guys , I have this query below where I want to get sum total_price value from a table called " car_maintenance" which is related to " bookings" the problem is that sum returns me double value..

this is the query

                                            DB::raw('sum(DATEDIFF(,bookings.from)) as bookingDays'),
                                            DB::raw('365-sum(DATEDIFF(,bookings.from)) as parkingStay'),
                                            DB::raw('cars.daily_price*sum(DATEDIFF(,bookings.from)) as gains'),
                                            DB::raw('sum(car_maintenance.total_price) as losts'))

Thank you

Please sign in or create an account to participate in this conversation.