Creating a Schedule Timetable

Question:
I have a table with five columns. They are “No. of People,” “Tour1,” Tour2,” “Tour3,” and “Tour4.” I want to set up a query that shows me how many people went to each tour by date.

My input table looks like this:

No. of People   Tour1   Tour2  Tour3  Tour43               5/3     5/4    5/5    n/a 2               5/4     5/3    5/5    5/64               n/a     5/4    5/3    5/4

My query table should show this:

 Date         Tour1   Tour2  Tour3  Tour45/3          3       2      4      05/4          2       7      0      45/5          0       0      5      05/6          0       0      0      2

That means having “Date” as my row heading, “Tour#” as my column heading, and “No. of People” (who joined that tour) as my cell content. How do I do this?

Answer:
Take a deep breath.

I think what you really have a design problem here, not a query problem. The first red herring is the column names you use; Tour 1 … Tour N is a text-book illustration of a repeating group and, as such, is a non-normal relation.

What if the table were structured like this instead?

 TourName      TourDate    TouristQtyTour 1        5/3         3Tour 1        5/4         2Tour 2        5/3         2Tour 2        5/4         7

I think this would simplify your issues, even though you are storing a total in TouristQty.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS