D
Daniel
Hi,
I've written a simple crosstab query based upon a select query which
has several left joins and subqueries in the WHERE clause. The select
query runs fine, but when I try to run the crosstab query it says that
"The Microsoft Jet database engine does not recognize 'tRs.ID' as a
valid field name or expression. tRs.ID is one of the fields that I
perform a LEFT JOIN on (not a parameter).
When I create a table from the select query, the crosstab query works
fine.
The crosstab query is:
TRANSFORM first(qR.revFlag)
SELECT qR.releaseID
FROM qtest2 AS qR INNER JOIN tblSchematicFieldsList AS SF ON
qR.schematicFieldsListID = SF.ID
GROUP BY qR.releaseID
PIVOT SF.fieldName & "_revFlag";
qtest2 is (with the apparently offensive tRs.ID in the FROM clause
rather than the SELECT clause because I can remove it from the SELECT
clause and still generate the error):
SELECT IIf(tRR.revOrder>8,IIf(tRR.revOrder=tRMax.revOrder,2,1),0) AS
revFlag, tEV.electricalID, tEV.schematicFieldsListID, tEV.fieldValue,
tRs.ID AS releaseID
FROM ((tblReleases AS tRs LEFT JOIN tblEquipMCCVals AS tEV ON
tRs.referenceID = tEV.electricalID)
LEFT JOIN qryReleasesToRevisions AS tRMax ON tRs.ID =
tRMax.releaseID)
LEFT JOIN qryReleasesToRevisions AS tRR ON tRs.ID = tRR.releaseID
WHERE tRR.ID=(SELECT TOP 1 t1.ID FROM qryReleasesToRevisions AS t1
WHERE t1.releaseID = tRs.ID
AND t1.revReleaseDate > tEV.modDate ORDER BY t1.revOrder ASC)
AND tRs.documentTypeID=4
AND tRMax.ID=(SELECT TOP 1 t2.ID FROM qryReleasesToRevisions AS t2
WHERE t2.releaseID = tRs.ID ORDER BY t2.revOrder ASC);
Am I making a mistake? Is this a known limitation of crosstab
queries?
Thank you,
Daniel
I've written a simple crosstab query based upon a select query which
has several left joins and subqueries in the WHERE clause. The select
query runs fine, but when I try to run the crosstab query it says that
"The Microsoft Jet database engine does not recognize 'tRs.ID' as a
valid field name or expression. tRs.ID is one of the fields that I
perform a LEFT JOIN on (not a parameter).
When I create a table from the select query, the crosstab query works
fine.
The crosstab query is:
TRANSFORM first(qR.revFlag)
SELECT qR.releaseID
FROM qtest2 AS qR INNER JOIN tblSchematicFieldsList AS SF ON
qR.schematicFieldsListID = SF.ID
GROUP BY qR.releaseID
PIVOT SF.fieldName & "_revFlag";
qtest2 is (with the apparently offensive tRs.ID in the FROM clause
rather than the SELECT clause because I can remove it from the SELECT
clause and still generate the error):
SELECT IIf(tRR.revOrder>8,IIf(tRR.revOrder=tRMax.revOrder,2,1),0) AS
revFlag, tEV.electricalID, tEV.schematicFieldsListID, tEV.fieldValue,
tRs.ID AS releaseID
FROM ((tblReleases AS tRs LEFT JOIN tblEquipMCCVals AS tEV ON
tRs.referenceID = tEV.electricalID)
LEFT JOIN qryReleasesToRevisions AS tRMax ON tRs.ID =
tRMax.releaseID)
LEFT JOIN qryReleasesToRevisions AS tRR ON tRs.ID = tRR.releaseID
WHERE tRR.ID=(SELECT TOP 1 t1.ID FROM qryReleasesToRevisions AS t1
WHERE t1.releaseID = tRs.ID
AND t1.revReleaseDate > tEV.modDate ORDER BY t1.revOrder ASC)
AND tRs.documentTypeID=4
AND tRMax.ID=(SELECT TOP 1 t2.ID FROM qryReleasesToRevisions AS t2
WHERE t2.releaseID = tRs.ID ORDER BY t2.revOrder ASC);
Am I making a mistake? Is this a known limitation of crosstab
queries?
Thank you,
Daniel