Instrument Date Result
Machine1 12/01/2009 20.1
Machine1 12/01/2009 22.5
Machine1 12/02/2009 23
Machine2 12/01/2009 25
Machine2 12/02/2009 24
I would like the query to show the following:
Machine1 Machine2
20.1 25
22.5 24
23
The fact that I have multiple results on the same date is causing me
problems.
Any suggestions?
Thanks
SELECT Q.Instrument, Q.Result, Q.YourDate, (SELECT COUNT(*) FROM [YourTable]
Q1
WHERE Q1.[Instrument] = Q.[Instrument]
AND Q1.[YourDate] < Q.[YourDate])+1 AS Rank INTO tblTemp
FROM YourTable AS Q
ORDER BY Q.Instrument, Q.YourDate;
TRANSFORM First(tblTemp.Result) AS FirstOfResult
SELECT tblTemp.Rank AS Entry
FROM tblTemp
GROUP BY tblTemp.Rank
PIVOT tblTemp.Instrument;
--
Build a little, test a little.
Do you have some type of primary key or other value that can be used? If
not, your problem is quite difficult to resolve without code.
--
Duane Hookom
Microsoft Access MVP