How i can populate 3 Table with...
Posted: Wed Apr 28, 2010 2:23 am
Hi i am facing with a complex feature ,till now i have not luck so i decide to advices to understand if it is possible create a report with my method.
I have a Database with 3 DataTables as i list below :
- Hotel_Meals_TBL { HotelCodeID (PK) , HotelName, Stars};
- HotelPeriod_TBL {PeriodID(PK) , HotelCodeID (FK) , PeriodName(Low,High,Peak) , _From, _To};
- HotelRoom_TBL {RoomID(PK), HotelCodeID (FK), RoomName, SGL_LowSeason, DBL_LowSeason, TPL_LowSeason , SGL_HighSeason, DBL_HighSeason, TPL_HighSeason, SGL_PeakSeason, DBL_PeakSeason, TPL_PeakSeason, Dinner, Lunch};
My purpose is to retrieve the data and show in 3 different Table in the Report following the PeriodName with these column as follow:
- First Table : PeriodName= 'Low' :
HotelName , Stars , PeriodName, _From, _To, RoomName, SGL_LowSeason, DBL_LowSeason, TPL_LowSeason, Dinner , Lunch;
-Second Table PeriodName = 'High' :
HotelName , Stars , PeriodName, _From, _To, RoomName, SGL_HighSeason, DBL_HighSeason, TPL_HighSeason, Dinner , Lunch;
- Third Table PeriodName = 'Peak' :
HotelName , Stars , PeriodName, _From, _To, RoomName, SGL_PeakSeason, DBL_PeakSeason, TPL_PeakSeason, Dinner , Lunch;
I use this query to populate the First Table :
SELECT Hotel_Meals_TBL.HotelName, Hotel_Meals_TBL.Stars, HotelPeriod_TBL.PeriodName,
HotelPeriod_TBL._From, HotelPeriod_TBL._To, HotelRoom_TBL.RoomName, HotelRoom_TBL.SGL_LowSeason, HotelRoom_TBL.DBL_LowSeason,HotelRoom_TBL.TPL_LowSeason,
HotelRoom_TBL.Lunch, HotelRoom_TBL.Dinner
FROM HotelRoom_TBL, HotelPeriod_TBL,Hotel_Meals_TBL
WHERE Hotel_Meals_TBL.HotelCodeID = HotelPeriod_TBL.HotelCodeID AND Hotel_Meals_TBL.HotelCodeID = HotelRoom_TBL.HotelCodeID
AND HotelPeriod_TBL.HotelCodeID = HotelRoom_TBL.HotelCodeID AND HotelPeriod_TBL.PeriodName = 'Low'
with this query i can populate the First Table but not in correct way in each row show always the same record !!!
I don't know if my way is right or isn't to populate the 3 Table depending from the PeriodName (Low,High,Peak) so i ask you a suggestion ,idea to clarify my way and help me to go on to work out this trouble.
Thanks in advantage for your attention.
Have a good day.
Best regards
I have a Database with 3 DataTables as i list below :
- Hotel_Meals_TBL { HotelCodeID (PK) , HotelName, Stars};
- HotelPeriod_TBL {PeriodID(PK) , HotelCodeID (FK) , PeriodName(Low,High,Peak) , _From, _To};
- HotelRoom_TBL {RoomID(PK), HotelCodeID (FK), RoomName, SGL_LowSeason, DBL_LowSeason, TPL_LowSeason , SGL_HighSeason, DBL_HighSeason, TPL_HighSeason, SGL_PeakSeason, DBL_PeakSeason, TPL_PeakSeason, Dinner, Lunch};
My purpose is to retrieve the data and show in 3 different Table in the Report following the PeriodName with these column as follow:
- First Table : PeriodName= 'Low' :
HotelName , Stars , PeriodName, _From, _To, RoomName, SGL_LowSeason, DBL_LowSeason, TPL_LowSeason, Dinner , Lunch;
-Second Table PeriodName = 'High' :
HotelName , Stars , PeriodName, _From, _To, RoomName, SGL_HighSeason, DBL_HighSeason, TPL_HighSeason, Dinner , Lunch;
- Third Table PeriodName = 'Peak' :
HotelName , Stars , PeriodName, _From, _To, RoomName, SGL_PeakSeason, DBL_PeakSeason, TPL_PeakSeason, Dinner , Lunch;
I use this query to populate the First Table :
SELECT Hotel_Meals_TBL.HotelName, Hotel_Meals_TBL.Stars, HotelPeriod_TBL.PeriodName,
HotelPeriod_TBL._From, HotelPeriod_TBL._To, HotelRoom_TBL.RoomName, HotelRoom_TBL.SGL_LowSeason, HotelRoom_TBL.DBL_LowSeason,HotelRoom_TBL.TPL_LowSeason,
HotelRoom_TBL.Lunch, HotelRoom_TBL.Dinner
FROM HotelRoom_TBL, HotelPeriod_TBL,Hotel_Meals_TBL
WHERE Hotel_Meals_TBL.HotelCodeID = HotelPeriod_TBL.HotelCodeID AND Hotel_Meals_TBL.HotelCodeID = HotelRoom_TBL.HotelCodeID
AND HotelPeriod_TBL.HotelCodeID = HotelRoom_TBL.HotelCodeID AND HotelPeriod_TBL.PeriodName = 'Low'
with this query i can populate the First Table but not in correct way in each row show always the same record !!!
I don't know if my way is right or isn't to populate the 3 Table depending from the PeriodName (Low,High,Peak) so i ask you a suggestion ,idea to clarify my way and help me to go on to work out this trouble.
Thanks in advantage for your attention.
Have a good day.
Best regards