Microsoft
Software
Hardware
Network
Question : SQLServer Query, Pivot and/or Cross tab or whatever
Ok here's the deal. I'm working on this late at night tonight and need an asnwer quick. I pretty much need "yes it's possible with simple query and here's how" or "no, it isn't possible without reporting tool (Cognos or Crystal etc)"
I'm using Excel VBA (user friendly and cheap) and writing a report. I need a query to do the following.....
I have a SQLServer table named Matter. In it is two columns, STAFF and CCODE. If the table has:
STAFF CCODE
GDJ PI
GDJ PI
GDJ PRO
RJJ PI
RJJ WC
RJJ MISC
RBC WC
How do I get a query result of:
CCODE RBC GDJ RJJ
PI 0 2 1
WC 1 0 1
MISC 0 0 1
PRO 0 1 0
Can I get this with a query from VBA without prior knowledge of any staff initials or codes, or would this type of thing require a reporting tool? I'm a database administrator but my knowledge of SQL reporting stops here. =)
Answer : SQLServer Query, Pivot and/or Cross tab or whatever
You are not stating the exact "Graphical" Output you are seeking.
My guess is that you want to see a unique list of all used dates and along with each of these dates you want to see the associated Topics, Cases, ...etc
I am not sure that Access can represent the query you are after, but this can easily be done with a Report and two subreports.
The Main Report being the list of unique, used dates
The two subreports being the Cases and Topics tables respectively.
The subreports are linked on the unique date to their corresponding dates.
Here is a sample.
The Report is named: rptDatesCasesTopics
If this is what you wanted, I am sure that you can modify it to fit your needs.
;-)
JeffCoachman
Random Solutions
Migrate SBS 2003 to Hyper-V
SqlDataAdapter InsertCommand not updating primary key value in dataset
Split String in C#
How to get an USB speaker to work with Eee PC 900 Xandros Linux
Unable to access certain domains
how to truncate the transaction logs in exchange 2010 after NT backup
Font Question
customized toolbar in Access 2007
red ant
Macbook very slow after harddrive upgrade