SQL query access pivot - error message 'field that has an invalid data type'
-
21-12-2019 - |
Question
I'm running an SQL Query on MS Access.
the query looks like this:
TRANSFORM MIN(X_VALUE*MULTIPLE & ' ' & Y_VALUE)
SELECT A.ID
FROM ((MY_TABLE_A A
INNER JOIN MY_TABLE_B B ON B.ID = A.ID)
INNER JOIN MY_TABLE_C C ON C.FOO1_ID = A.FOO1_ID)
LEFT JOIN MY_TABLE_D D ON A.FOO2_ID = D.FOO2_ID
GROUP BY A.ID PIVOT X_NAME IN('BLAH1', 'BLAH2')
when running this against local MDB file, it works. when running this against Linked MDB (tables are linked to remote Oracle DB), I'm getting
ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine could not execute the SQL statement because it contains a field that has an invalid data type.
I've googled it, and couldn't find anything useful.
Any idea what can I do? thanks.
Solution
The only statement in the query that even vaguely seems it would cause data type issues is the mixed types in the transform statement. Perhaps the following would work:
TRANSFORM MIN(CSTR(X_VALUE*MULTIPLE) & ' ' & CSTR(Y_VALUE))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow