Results 1 to 4 of 4
  1. #1
    humanmaycry is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    4

    cross table problem

    I right now have a big issue which torch me for days.


    I have a table like this
    name course1 course2 course3
    Chris 1 1 0
    Patti 0 1 1
    Alice 0 0 1

    I want to have a result like:
    Name CourseChosen
    Chris course1
    Chris course2
    Patti course2
    Patti course3
    Alice course3

    How could I do this? please help!
    the number in the original table, 1 represents chosen and 0 represents non-chose.
    Thanks for help!
    Regards

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try a UNION query:

    SELECT Name, "Course1" AS CourseChosen
    FROM TableName
    WHERE Course1 = 1
    UNION ALL
    SELECT Name, "Course2" AS CourseChosen
    FROM TableName
    WHERE Course2 = 1
    UNION ALL
    ...
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    humanmaycry is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    4
    Thanks Pbaldy.
    Actually, I have tried this and it works. However the issue is, I have about 200 courses.
    I heard SQL has a function called " unpivot"
    it seems much easier, however I don't know if it support Access 2007

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sorry, I'm not familiar with a function like that (which doesn't mean it doesn't exist).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Problem with cross tab on column heading
    By pascal_22 in forum Queries
    Replies: 0
    Last Post: 12-01-2010, 08:00 AM
  2. Cross tab help
    By A S MANN in forum Queries
    Replies: 5
    Last Post: 10-28-2010, 07:46 AM
  3. Cross Tab Query
    By RycherX in forum Queries
    Replies: 1
    Last Post: 04-26-2010, 12:19 PM
  4. Reverse Cross Tab
    By indiana in forum Access
    Replies: 1
    Last Post: 03-12-2010, 10:11 PM
  5. Cross Tab Query
    By nengster in forum Queries
    Replies: 0
    Last Post: 02-18-2009, 07:12 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