Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Dynamic Columns In SQL Server
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

9 Posts

Posted - 01/18/2013 :  11:40:35  Show Profile  Reply with Quote
Hi There

I would like to know if it is possible to dynamically build the columns in your report.

this is what i want to do.

I have three tables Trips, Aid And Service that i would like to join
The Trips table is just a list of trips all trips have service but not necessarily aids. The aid and service tables are code tables (Code,Description).

I would like to be able to write a report that Lists the aid vertically and then the services horizontally in the services column i would like to know how many times an aid appears in the trips table under each service?


Aids serv1 serv2 serv3 serv4
aid1 1 2 3 4
aid2 3 1 2 5
aid3 4 2 1 2

I did find Cross Joins but im not really sure that was what i wanted.
And lots of places pretty much said i would have to create a table and join with that.

many Thank


Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/18/2013 :  13:44:53  Show Profile  Reply with Quote
just bring data by joining tables in report and use a matrix container

use aids field as rowgroup and service field as column group

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000