Jaymond Flurrie
Well-known Member
- Joined
- Sep 22, 2008
- Messages
- 921
- Office Version
- 365
- Platform
- Windows
I'm having a problem running an SQL query from Excel VBA code and my query is:
SELECT SUM (10) FROM [Ostoaineisto$]
Which gives me some weird number, 1000, as the answer
As soon as I rename the column as, say, "Mike", the result with query
SELECT SUM (Mike) FROM [Ostoaineisto$]
gives the correct number, 80, as the answer.
Any easy trick to tell to Excel/VBA/SQL/AdoDB that this "10" is not a number, it's a column name? I actually need to run the query against every single column there, so some simple "for each, return sum"-function would solve this too.
SELECT SUM (10) FROM [Ostoaineisto$]
Which gives me some weird number, 1000, as the answer
As soon as I rename the column as, say, "Mike", the result with query
SELECT SUM (Mike) FROM [Ostoaineisto$]
gives the correct number, 80, as the answer.
Any easy trick to tell to Excel/VBA/SQL/AdoDB that this "10" is not a number, it's a column name? I actually need to run the query against every single column there, so some simple "for each, return sum"-function would solve this too.