SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

12many
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?

imagine

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

Ian

visakh16
Very Important crosS Applying yaK Herder

India
52325 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
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.03 seconds. Powered By: Snitz Forums 2000