DD,
This is the closet that I could come but it doesn't seperate Questions per
Answer
TRANSFORM Last(YourTable.Answer) AS LastOfAnswer
SELECT YourTable.ID, YourTable.SurveryID
FROM YourTable
GROUP BY YourTable.ID, YourTable.SurveryID
PIVOT YourTable.Question;
--
Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
DD,
Not sure why you think this can't be done in a Crosstab query. Have you
tried? Did it not give you the results you want? If you did and it didn't,
show us the SQL of the query.
As a side note, yeppers Client is always right except when they are wrong
but they don't know that. You give them what they want to *see* but do it
right in the background. The customer should NEVER see the tables so
having
them normalized should not interfere with the display the way the Client
wants. Doesn't help you now, might actually be hurting because
unnormalized
tables always present a challenge when trying to extract information. Just
some food for thought for your next project!
--
Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Gina,
The table really is normalized though. We aren't doing the analysis,
the client wants to do it's own analysis so wants the tables. The
table is actually like below. The "ID' is actually the survey number.
ID Survey # Question Answer
1 1 q1 yes
2 1 q1 no
3 2 q1 yes
Crosstab doesn't work though because the data area for crosstabs is
always a calculated value. I want textual data, not a sum...count,
etc. I'm familiar with crosstabs but it's not quite right in this
case. If you didn't have to use a calculated value for the data
portion then we'd be closer. But still, the crosstab would group the
column headings such as "Q1". If 1 respondent provided 3 different
answers to Q1, like ID 2 above, then I'd want the output to look just
like the above. The closest I can come using Crosstab is below, but I
still have to use "First" or "Last" to get any text values in data. I
want all of them.
TRANSFORM First([Lyme Disease Comma Export 20091029].Response) AS
FirstOfResponse
SELECT [Lyme Disease Comma Export 20091029].Surveyid, First([Lyme
Disease Comma Export 20091029].Response) AS [Total Of Response]
FROM [Lyme Disease Comma Export 20091029]
GROUP BY [Lyme Disease Comma Export 20091029].Surveyid
PIVOT [Lyme Disease Comma Export 20091029].Question;