Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-02-25 : 07:45:27
|
| Jeff writes "I have a list of Distributors in a customer table. These distributors earn volume. Several distributors attended a meeting in LA in say Oct(MeetingID is 1 from Meeting Table). From a Commission table we track the volume earned by each Distributor by commission date. I need a query that pulls the data in such a way that we can see the month previous to Octobers volume as well as all other months to the current month in order to track the volume trends.The for tables involved are Meetings, MeetingAttend, Customer, CommrecMeeting1.MeetingID2.MeetingDate3.MeetingNameMeetingAttend1.MeetingID2.CustIDCustomer1.custid2.NameCommrec1.custid2.DateEntered3.PVolumeFrom these tables the report header needs to be:Meeting.MeetingName,Customer.custid,Customer.Name, Commrec.DateEntered as PrevMonth,Commrec.PVolume as PrevMonthPV,Commrec.DateEntered as MeetingMonth, Commrec.PVolume as MeetingMonthPV, etc...,commrec.DateEntered as CurrentMonth, commrec.PVolume as CurrentMonthPVI can get the information to line up as LA,1111,John Smith,September,25LA,1111,John Smith,October,27LA,1111,John Smith,November,31etc. I don't know how to do it across the Header linearly with Dynamic header names and have the data line up vertically instead of horizontally.Any direction of where to even look or the name of the command to use would be most helpful.Thanks" |
|
|
drymchaser
Aged Yak Warrior
552 Posts |
Posted - 2004-02-25 : 09:23:07
|
| I'm not completely sure of what you are asking, but it looks like you need to do a article/forum search here for DYNAMIC CROSS-TAB. |
 |
|
|
|
|
|
|
|