P
Peter Baughman
BACKGROUND:
I'm using microsoft access 2003 Version 11.8204.8221 SP3
I have a database that contains a table "Parts" and a table "Tests"
Parts contains the following columns: Name (text) and PartId (Replication Id)
Tests contains the following columns: PartId (ReplicationId) TestId
(ReplicationId )TestTime (Date/Time) and Data (double)
Tests has a many to one relationship with Parts on Tests.PartId and
Parts.PartId.
THE PROBLEM:
I'm trying to write a query that will return a part name and the test Id of
the most recent test. The query that i've written is:
SELECT Parts.Name, (SELECT TOP 1 (Tests.TestId) FROM Tests WHERE
Tests.PartId = Parts.PartId ORDER BY TestTime DESC) AS Expr1
FROM Parts;
This query returns the Part Names in the first column, but empty cells in
the second column. I expect it to return the Part Name in the first column
and the GUID of the latest test in the second column.
ADDITIONAL INFORMATION:
The query:
SELECT Parts.NAME, (SELECT TOP 1 (Tests.Data) FROM Tests WHERE Tests.PartId
= Parts.PartId ORDER BY TestTime DESC) AS Expr1
FROM Parts;
Returns the Part names in the first column and the data from the most recent
test in the second column just like I would expect it to. The only thing
that has changed is the arguement to TOP 1 in the subquery.
Finally, the query:
SELECT Parts.Name, (SELECT COUNT(Tests.TestId) FROM Tests WHERE Tests.PartId
= Parts.PartId) AS Expr1
FROM Parts;
Returns the name of each part in the first column and the number of tests
that were run on that part in the second column just like I would expect it
to.
This indicates to me that inside the subquery, Tests.TestId works, however
for some reason the subquery cannot return this replication ID and have it
display properly in the first column
I'm using microsoft access 2003 Version 11.8204.8221 SP3
I have a database that contains a table "Parts" and a table "Tests"
Parts contains the following columns: Name (text) and PartId (Replication Id)
Tests contains the following columns: PartId (ReplicationId) TestId
(ReplicationId )TestTime (Date/Time) and Data (double)
Tests has a many to one relationship with Parts on Tests.PartId and
Parts.PartId.
THE PROBLEM:
I'm trying to write a query that will return a part name and the test Id of
the most recent test. The query that i've written is:
SELECT Parts.Name, (SELECT TOP 1 (Tests.TestId) FROM Tests WHERE
Tests.PartId = Parts.PartId ORDER BY TestTime DESC) AS Expr1
FROM Parts;
This query returns the Part Names in the first column, but empty cells in
the second column. I expect it to return the Part Name in the first column
and the GUID of the latest test in the second column.
ADDITIONAL INFORMATION:
The query:
SELECT Parts.NAME, (SELECT TOP 1 (Tests.Data) FROM Tests WHERE Tests.PartId
= Parts.PartId ORDER BY TestTime DESC) AS Expr1
FROM Parts;
Returns the Part names in the first column and the data from the most recent
test in the second column just like I would expect it to. The only thing
that has changed is the arguement to TOP 1 in the subquery.
Finally, the query:
SELECT Parts.Name, (SELECT COUNT(Tests.TestId) FROM Tests WHERE Tests.PartId
= Parts.PartId) AS Expr1
FROM Parts;
Returns the name of each part in the first column and the number of tests
that were run on that part in the second column just like I would expect it
to.
This indicates to me that inside the subquery, Tests.TestId works, however
for some reason the subquery cannot return this replication ID and have it
display properly in the first column