Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Pivot table

Pivot table

Scheduled Pinned Locked Moved Database
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amina89
    wrote on last edited by
    #1

    Hello, I have a table matter (id_mat, libelle_mat, id_module) to have names of matter on the header I used pivot table select [411] AS '411 ', [412] AS '412', [413] AS '413',.... or 411 ,412.... are id_mat how can I do if I dont know the number of matter? I wanted to display in the header every libelle_mat of a module. (I work with sqlserver2008) Thank you.

    M 1 Reply Last reply
    0
    • A amina89

      Hello, I have a table matter (id_mat, libelle_mat, id_module) to have names of matter on the header I used pivot table select [411] AS '411 ', [412] AS '412', [413] AS '413',.... or 411 ,412.... are id_mat how can I do if I dont know the number of matter? I wanted to display in the header every libelle_mat of a module. (I work with sqlserver2008) Thank you.

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Wait for it.... here is an article that might help - Pivot two or more columns in SQL Server 2005[^]

      Never underestimate the power of human stupidity RAH

      A 1 Reply Last reply
      0
      • M Mycroft Holmes

        Wait for it.... here is an article that might help - Pivot two or more columns in SQL Server 2005[^]

        Never underestimate the power of human stupidity RAH

        A Offline
        A Offline
        amina89
        wrote on last edited by
        #3

        Hi, I think I did not explain my problem,how to display matter of a module in header if I dont know know the number of matter because the user add and delete it. Thanks.

        M 1 Reply Last reply
        0
        • A amina89

          Hi, I think I did not explain my problem,how to display matter of a module in header if I dont know know the number of matter because the user add and delete it. Thanks.

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          That is precisely what I do in the article, buid a string of column headers from the data and build a pivot query based on that. Read the article!

          Never underestimate the power of human stupidity RAH

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups