Results 1 to 5 of 5
  1. #1
    FL0XN0X is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Belgium
    Posts
    84

    Soem kind of cross tab query needed ?

    Dear,

    I have 3 tables:

    Calendar Customer Type of reservation
    Id Date Id Name Id Reservation Type
    1 1/01/2018 1 Matthew 1 AM
    2 2/01/2018 2 Jake 2 PM
    3 3/01/2018 3 Els 3 D
    Table 1: Table holding a calendar
    Table 2: Table holding Customers info


    Table 3 : Table holding information of the type of reservation

    Now, I got a query that populates a table that show per date which customer has which type of reservation, resulting in table:

    Reservation
    Id CalendarId CustomerId Type of Reservation Id
    1 1 1 1
    2 1 2 1
    3 1 3 3
    4 2 1 1
    5 2 2 2
    6 2 3 1
    7 3 1 3
    8 3 2 2
    10 3 3 1
    11

    Question
    How to make the query that lists the dates (group by) and then shows a column per type of reservation and count the number of times that type of reservation occurred for that date. For the example above, result should be:

    Query
    Id Date # AM # PM # D
    1 1/01/2018 2 0 1
    2 2/01/2018 2 1 0
    3 3/01/2018 1 1 1

    Thank you in advance.
    Kind regards,
    Bart

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    It would be easier to answer if you can post the relevant tables from your database
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    FL0XN0X is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Belgium
    Posts
    84
    The tables I have contains exact the same type of info, only more records. In the example above , I have provided only 3 dates, 3 customers, and 3 types of reservations. So I'm looking for the solution for the above tables. I can extrapolate/derive the correct solution then myself on the 'live' data.
    Kind regards,
    Bart

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    I appreciate that you have provided the exact table structure

    I'm happy to help but I'm going out in about an hour
    Creating crosstab queries as 'air code' isn't easy and liable to errors.
    For that reason, it is much easier to work with the actual tables.

    I could create a copy of your db & paste in your sample data.
    However, you already have the tables & could do that very easily.
    Create a new db, copy the 3 tables, empty them & then paste in your sample data

    If you do that in the next 30 mins or so, I can probably provide a solution before I go out.
    If not, perhaps someone else will do it as air code or manually create the db themselves
    Up to you ....

    P.S. Posting a second near identical thread won't get you a quicker answer
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    FL0XN0X is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Belgium
    Posts
    84
    it was solved in the Query section of the forum

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 08-15-2017, 08:44 AM
  2. Unmatched Query (Kind of)
    By lzook88 in forum Queries
    Replies: 5
    Last Post: 12-23-2015, 12:49 PM
  3. Replies: 2
    Last Post: 10-02-2012, 03:18 PM
  4. Some kind of lookup query
    By borge in forum Queries
    Replies: 1
    Last Post: 10-16-2011, 03:13 PM
  5. What kind of query do I need?
    By cowboy in forum Queries
    Replies: 1
    Last Post: 02-17-2010, 04:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums