季節(高、低)の異なる部屋の料金でこの表を持っています
異なる日と異なる季節で5日間の合計価格を取得するにはどうすればよいですか..
この表を見てください
これは私のコマンドです(mysql)2013年4月7日から2013年7月11日までの10泊の合計金額を取得 したい
select sum(
case when dayname('2013-01-07') = 'Monday' then coalesce(prices.room_price , def.room_price)
when dayname('2013-01-07') = 'Sunday' then coalesce(prices.room_price , def.room_price)
)as TotalPrice
from (select strtodate('2013-01-07' , '%Y-%m-%d') as thedate
select strtodate('2013-01-08' , '%Y-%m-%d') as thedate ) dates left outer join ts_room_prices prices
on dates.thedate between prices.season_start and prices.season_end cross join ts_room prices def on def.season_name = 'default'
添加
このコマンドを作成しましたが、まだ機能しません
select sum(coalesce(prices.room_price , def.room_price) ) as TotalPrice
from (select strtodate('2013-01-07' , '%Y-%m-%d') as thedate union all
select strtodate('2013-01-08' , '%Y-%m-%d') as thedate
) dates left outer join
ts_room_prices prices
on dates.thedate between prices.season_start and prices.season_end and
dayname(dates.thedate) = prices.dayofweek join ts_room_prices def
on def.season_name = 'default' and
def.hotel = 3233 and
def.dayofweek = dayname(dates.thedate)
エラー:#1305-関数saudihot_saudihotels.strtodateが存在しません