I'm using the ADODB text driver to query some .dat files. I want to be able to query two seperate files and merge the results into one recordset. It seems like a Union query is what I should be doing.
Individually, this works...
But when I try to use the union all I get an error saying..."You tried to execute a query that does not include the specified expression 'CE' as part of an agregate function."
Any idea what I'm doing wrong? The following is the SQL that gives me the error...
Individually, this works...
Code:
"SELECT a.CE, a.REMARK, b.TEAM, Count(a.REMARK) AS RmkCount "
"FROM [" & ThisFilename & "] a, [CETEAM.txt] b "
"Where a.CE = b.CE AND a.aDate >= #" & theStart & "# AND a.aDate <= #" & theEnd & "# "
"GROUP BY a.CE, a.Remark, b.TEAM "
"ORDER BY b.TEAM, a.Remark "
Any idea what I'm doing wrong? The following is the SQL that gives me the error...
Code:
"SELECT a.CE, a.REMARK, b.TEAM, Count(a.REMARK) AS RmkCount "
"FROM [" & ThisFilename & "] a, [CETEAM.txt] b "
"UNION ALL "
"SELECT a.CE, a.REMARK, b.TEAM , Count(a.REMARK) AS RmkCount "
"FROM [" & NextFilename & "] a, [CETEAM.txt] b "
"WHERE a.CE = b.CE AND a.aDate >= #" & theStart & "# AND a.aDate <= #" & theEnd & "# "
"GROUP BY a.CE, a.Remark, b.TEAM "
"ORDER BY b.TEAM, a.Remark "