rnorthcott
New member
- Local time
- Today, 16:57
- Joined
- Dec 2, 2023
- Messages
- 8
Good morning,
I'm looking for some assistance with a couple what I'm thinking are slightly more advanced queries for the registration database I'm working on for a client.
Firstly, I have a table that tracks reservations made by visitors, which is linked to a table of information related to the people who are attending using that particular reservation. When I look at the parent table in table view, I can expand the reservation row to view the related information from the sub table, as seen in the screenshot below. Is it possible to reproduce this resulting view using a query?
Secondly, my client has asked that she be able to run a query that will report the total number of each entrance fee purchased. I can run a query that totals the number of visitors that purchased each type of entrance fee, but it doesn't take into consideration the length of time the visitor was in the park. For example, if I stay for 7 days and purchase a day pass for each day that should contribute 7 day pass purchases to the total not just one. My first thoughts would be to do something like this algorithm, just not sure exactly what it would look like.
Set a counter variable for each daily entry type to 0
Collect the list of visitors who entered the park
Step through each visitor and determine what entry fee type they paid, the length of their stay (by subtracting the Start Date from the End Date and adding 1), and if they purchased a daily entry fee, add the product of those two numbers to the correct counter variable
Display the results
Perhaps there is a better way to do it as well. The two tables involved are tblReservations that contains the ReservationNumber, Start Date and End Date and tblVisitors that links to the primary table via ReservationNumber and contains the fee type each visitor paid.
Let me know if you need any additional information, and I appreciate any help that can be provided.
Raymond
I'm looking for some assistance with a couple what I'm thinking are slightly more advanced queries for the registration database I'm working on for a client.
Firstly, I have a table that tracks reservations made by visitors, which is linked to a table of information related to the people who are attending using that particular reservation. When I look at the parent table in table view, I can expand the reservation row to view the related information from the sub table, as seen in the screenshot below. Is it possible to reproduce this resulting view using a query?
Secondly, my client has asked that she be able to run a query that will report the total number of each entrance fee purchased. I can run a query that totals the number of visitors that purchased each type of entrance fee, but it doesn't take into consideration the length of time the visitor was in the park. For example, if I stay for 7 days and purchase a day pass for each day that should contribute 7 day pass purchases to the total not just one. My first thoughts would be to do something like this algorithm, just not sure exactly what it would look like.
Set a counter variable for each daily entry type to 0
Collect the list of visitors who entered the park
Step through each visitor and determine what entry fee type they paid, the length of their stay (by subtracting the Start Date from the End Date and adding 1), and if they purchased a daily entry fee, add the product of those two numbers to the correct counter variable
Display the results
Perhaps there is a better way to do it as well. The two tables involved are tblReservations that contains the ReservationNumber, Start Date and End Date and tblVisitors that links to the primary table via ReservationNumber and contains the fee type each visitor paid.
Let me know if you need any additional information, and I appreciate any help that can be provided.
Raymond