Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    3

    Unanswered: Query - Crosstab ?

    Hi Good Morning,

    I currently have a query that displays six columns:


    Company | Product1 | Product2 | Product3 | Product4 | Product5


    So one row displays one company with five different products.

    What I need is some kind of query that will display the data like this:


    Company | Product1

    Company | Product2

    Company | Product3

    Company | Product4

    Company | Product5


    Basically the same company would be shown five times (on different rows) with the different Products on each.

    I'm sure there's a way to do this with a crosstab but I could do with some new ideas as I'm in a rut !

    Thanks very much in advance for your assistance.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Actually a crosstab does the reverse, taking properly normalized data and making it like your first example. You would need a UNION query to get the data from the first example to the second.
    Paul

  3. #3
    Join Date
    Jan 2010
    Posts
    1
    A union query would give you the desired results, for example:

    SELECT Table.company, Table.part1
    FROM [Table]

    UNION SELECT Table.company, Table.part2
    FROM [Table]

    UNION SELECT Table.company, Table.part3
    FROM [Table];

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •