Wayne-I-M said:
Hi Dirk
I agree with you about the e mail / member ID thing (too busy doing 2
things at once, as my wife keeps telling e <
But the HAVING and not WHERE ???
Can you explain this as I always like to see where I have gone wrong.
I just loaded a few fields into a trail table and then used the WHERE
in a query and it seems to work. BUT I have learnt to trust the
advice of MVP's so if you could give me a hint I would appreciate it.
Sure. Let's see the SQL of the query that "seems to work". I say that
any criteria based on an aggregate function must be applied in a HAVING
clause, not a WHERE clause. A WHERE clause may be used to filter the
records before the grouping takes place, but it can't contain an
aggregate function such as Count() or Sum(). If I paste your proposed
SQL into the SQL View of a new query, I can't even switch to Design
View, because it tells me, "Syntax error (missing operator) in query
expression 'memberID WHERE Count(Email) =4'.
Did you build your query in Design View? If so, and you simply entered
your criterion on the Criteria: line after making it a Totals query, you
will have gotten a HAVING clause, not a WHERE clause. To get a WHERE
clause in a Totals query, you have to select "Where" on the Totals:
line, as well as put the criterion on the Criteria: line.
I don't see how anything like the SQL you posted could work. It's
always possible that I'm missing something, though, so post your working
SQL and let me see what you've done.