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. SQL Server Syntax for a CROSSTAB QUERY from MSAccess

SQL Server Syntax for a CROSSTAB QUERY from MSAccess

Scheduled Pinned Locked Moved Database
databasesql-serversysadmintutorialquestion
2 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
    acosmin
    wrote on last edited by
    #1

    Here is a resultset: ID Name Value --------------------------------- 101 Name1 Value1 101 Name2 Value2 101 Name3 Value3 101 Name4 Value4 101 Name5 Value5 101 Name6 Value6 Could anyone tell me a way that could transform the above resultset in something like next one? (I'd prefer an SQL approach / not cursors and so on... but i appreciate them anyway). Name1 Name2 Name3 Name4 Name5 Name6 ---------------------------------------------- Value1 Value2 Value3 Value4 Value5 Value6 Is there any solution that don't use OLAP or extended procedures? ThanX, :confused: In MSAccess things are simple (see Crosstab query) - but in SQL Server 7 I don't know how to do it.

    N 1 Reply Last reply
    0
    • A acosmin

      Here is a resultset: ID Name Value --------------------------------- 101 Name1 Value1 101 Name2 Value2 101 Name3 Value3 101 Name4 Value4 101 Name5 Value5 101 Name6 Value6 Could anyone tell me a way that could transform the above resultset in something like next one? (I'd prefer an SQL approach / not cursors and so on... but i appreciate them anyway). Name1 Name2 Name3 Name4 Name5 Name6 ---------------------------------------------- Value1 Value2 Value3 Value4 Value5 Value6 Is there any solution that don't use OLAP or extended procedures? ThanX, :confused: In MSAccess things are simple (see Crosstab query) - but in SQL Server 7 I don't know how to do it.

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      acosmin wrote: Is there any solution that don't use OLAP or extended procedures? Absolutely. Ok, for my 2 cents worth I think you need to look at what you are asking. An SQL statement is returning a recordset to you, you however just want to modify the display. While manytimes "modifying" the display of a recordset can be easily done within the SQL statement itself, manytimes this is not the route to follow. What I am getting to is if you iterate through the recordset and throw the values into an array structure you can easily display your output as you want (from the array) it without modifying the SQL statement at all. What language are working with? Does this help at all? Nick Parker
      May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


      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