I've got three tables I'm dealing with. One table holds rental property info(tbl_RentalListing), one is rental rates and availibility by date(tbl_RentalRates), and the third is a reference table that holds the values for weeks 1-52(tbl_weeks).
I want to be able to create a trigger that will aoutomatically insert a record for each week in the year for each rental listing when a new listing is inserted. Here's how my thought process is working"
a new record is created in tbl_RentalListing
the trigger would do something like this:
make variable p to hold current listing id
make variable w to hold the current week
make p equal to the listing id from the insert tble creaated by the trigger
make w equal to 0
for w <= 52
Insert new record into tbl_RentalRates('p', 'w')
next
The idea is that each time a new rental is listed, the rates table will automatically contain the rows for all weeks. I want to prevent a user from missing a week or even having to create each record by hand. Later they can tehn go in and just update with the necessary info such as price and status of availibility.
Thanks in advance for any help you could provide.
I want to be able to create a trigger that will aoutomatically insert a record for each week in the year for each rental listing when a new listing is inserted. Here's how my thought process is working"
a new record is created in tbl_RentalListing
the trigger would do something like this:
make variable p to hold current listing id
make variable w to hold the current week
make p equal to the listing id from the insert tble creaated by the trigger
make w equal to 0
for w <= 52
Insert new record into tbl_RentalRates('p', 'w')
next
The idea is that each time a new rental is listed, the rates table will automatically contain the rows for all weeks. I want to prevent a user from missing a week or even having to create each record by hand. Later they can tehn go in and just update with the necessary info such as price and status of availibility.
Thanks in advance for any help you could provide.