hi,
i am new in SQL, i need this.
i have two tables (1) - Hotel (2) - Rates in 1st table i have fields autoid, name, rating, description and in
2nd table i have periodfrom, periodto, singleroomrate, doubleroomrate, RefHotelid
here period from and periodto are the datetime fields having the validatiy of rates tariff, suppose hotel A says
from this date to this date our rate sheet will be this but will be diferent from next month to additional 2 months
and RefHotelId is the basically the AutoId of the 1st Table, it can be repeated because single hotle can have many rate tariff
within a month or within a year.
so i wnat to select the name and description from first hotel where hotel rating is 2 and rest of the info means rates from 2nd table
based on selected autoid from 1st table for desired rating hotel how cna i get this.
like what i made query but it shows strange results.
select A.HotelName,B.SglPayableRate [Single Room Rate],B.DblPayableRate [Double Room Rate],B.TSUPayableRate [TSU Room Rate],B.QuadPayableRate [Quarter room Rate] from tblHotel A INNER JOIN tblHotelTariff B ON B.RefHotelID = (Select AutoID from tblHotel where StarRating = 2) AND PeriodFrom >= '5/25/2007' and PeriodTo <='6/2/2007'