sql - strtodate mysql function not exsit .. mysql query -


i have table price rooms ,

there 3 seasons (deafult , low , hight ) , want search 2 dates total price diffrent days , seasons ..

this table , query

http://sqlfiddle.com/#!2/7ebc2/1

how can calculate total price 5 days (mysql ) hotel booking system

select sum(coalesce(prices.room_price , def.room_price) ) totalprice (select strtotime('2013-05-07' , '%y-%m-%d') thedate union       select strtotime('2013-05-08' , '%y-%m-%d') thedate      ) dates left outer join      sh_rooms_price prices      on dates.thedate between prices.start_season , prices.end_season ,         dayname(dates.thedate) = prices.day_of_week join sh_rooms_price def     on def.season_price = 'default' ,        def.id_hotel = 5544 ,        def.day_of_week = dayname(dates.thedate) 

error appear: strtotime not exist

strtotime not valid function in mysql. defined php. try using str_to_date.

the modified query works fine.

select sum(coalesce(prices.room_price , def.room_price) ) totalprice (select str_to_date('2013-05-15' , '%y-%m-%d') thedate union       select str_to_date('2013-05-08' , '%y-%m-%d') thedate      ) dates left outer join      sh_rooms_price prices      on dates.thedate between prices.start_season , prices.end_season ,         dayname(dates.thedate) = prices.day_of_week join sh_rooms_price def     on def.season_price = 'default' ,        def.id_hotel = 5544 ,        def.day_of_week = dayname(dates.thedate); 

. view sqlfiddle


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -