Query based on a Query

M

Mike Labosh

Why does Access 2000 still have this behavior where it mashes the SQL from
both queries before it executes?

In Query1, I have a straight SELECT stuff FROM table. One of the items in
the select list is Right$([ProdCode], 12).

Query2 is one I made by running the Find Duplicates wizard. So Query2 goes
something like this:

SELECT ProdCode, ... FROM Query1 WHERE ProdCode IN (SELECT ProdCode FROM
theTable) As Tmp GROUP BY ProdCode HAVING COUNT(*) > 1)

Query1 runs just fine and gets the correct results.

Query2 hollers at me saying that I didn't put the Right$([ProdCode], 12) in
an aggregate function as required by the GROUP BY clause. There's no GROUP
BY inside Query1, and there's no Right$(...) in Query2. I hate Access doing
this. Query2 shouldn't know about the innards of Query1.

Is there any way around this dumb error without having to resort to a filthy
hack like turning Query1 into a MakeTable?
 
Top