PC Review


Reply
Thread Tools Rate Thread

Data into Crosstab

 
 
Jeffmarks
Guest
Posts: n/a
 
      26th Feb 2011
I have a table that looks like this:

Student Number Date Test Name Subject Area Test Score

My ultimate goal is to create 1 record per student number so that I
can export it and load it into SPSS for analysis.

Some records in the table represent tests that can only be taken once.
So I'm fine using a Crosstab for those, since there will not be any
conflicting data. Can I combine the Test Name and Subject Area into a
single field in the cross tab so that the data will be more meaningful
to me?

Also, how exactly do I handle tests that may be taken multiple times
(until the student passes)?

Thanks in advance for your help in this matter.

Jeff
 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      5th Mar 2011
Assumptions:
You don't need the date field in the results
The last test taken is the passed test
The number of different tests is less than 250
The combination of Subject Area and Test Name is less characters than the
maximum allowed for a column name (64 characters).

If you have a small number of records the following should work for you.

TRANSFORM First([Test Score]) as TestScore
SELECT [Student Number]
, [Test Name]
, [Subject Area] as Subject
, Max([Date]) as TestDate
FROM [YourTable] as T1
WHERE [YourTable].[Date] =
(SELECT Max([Date])
FROM [YourTable] as T2
WHERE T2.[Student Number] = T1.[Student Number]
AND T2.[Test Name] = T1.[Test Name]
AND T2.[Subject Area] = T1.[Subject Area])
GROUP BY [Student Number]
PIVOT [Subject Area] & " - " & [Test Name]

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 2/26/2011 9:25 AM, Jeffmarks wrote:
> I have a table that looks like this:
>
> Student Number Date Test Name Subject Area Test Score
>
> My ultimate goal is to create 1 record per student number so that I
> can export it and load it into SPSS for analysis.
>
> Some records in the table represent tests that can only be taken once.
> So I'm fine using a Crosstab for those, since there will not be any
> conflicting data. Can I combine the Test Name and Subject Area into a
> single field in the cross tab so that the data will be more meaningful
> to me?
>
> Also, how exactly do I handle tests that may be taken multiple times
> (until the student passes)?
>
> Thanks in advance for your help in this matter.
>
> Jeff

 
Reply With Quote
 
New Member
Join Date: Mar 2011
Posts: 1
 
      13th Mar 2011
I received the error message.

MS Office Database engine does not recognize T1.[StudentName] as a valid field name or expression.

The query looks like this:

TRANSFORM First(T1.[TestScore]) AS TestScore
SELECT T1.[StudentNumber], T1.[AssessmentTestName], T1.[AssessmentPartName] AS Subject, Max(T1.[TestingDate]) AS TestDate
FROM LMMI_Assessment AS T1
WHERE ((([LMMI_Assessment].[TestingDate])=(SELECT Max([TestingDate])
FROM [LMMI_Assessment] as T2
WHERE T2.[StudentNumber] = T1.[StudentNumber]
AND T2.[AssessmentTestName] = T1.[AssessmentTestName]
AND T2.[AssessmentPartName] = T1.[AssessmentPartName])))
GROUP BY T1.[StudentNumber]
PIVOT [AssessmentPartName] & " - " & [AssessmentTestName];
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grouping data - possible crosstab stuart Microsoft Access Queries 5 22nd Jun 2009 05:19 PM
Crosstab more than a years data?? Bill Microsoft Access Queries 12 14th Feb 2007 10:12 PM
Crosstab - if no data, then no heading =?Utf-8?B?c2hvcnRpY2FrZQ==?= Microsoft Access Queries 3 1st Feb 2007 08:27 PM
Query using crosstab data Chris Microsoft Access Queries 6 23rd Mar 2004 02:13 AM
Crosstab with no data aaron merriman Microsoft Access Reports 1 17th Oct 2003 03:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:33 AM.