having clause not accepted by MS Access

J

Jon

I'm running queries on the sample databases provided by Business Objects.
It's noted that the 'having' clause does not execute correctly within Ms
Access; in fact the application displays the following error:

Exception: DBD, [Microsoft][ODBC Microsoft Access Driver] Cannot have
aggregate function in expression
(sum(Shop_facts.Amount_sold)>=avg(sum(Shop_facts.Amount_sold))).State: HY000


SQL

SELECT

Calendar_year_lookup.Yr,

{fn concat('Q',Calendar_year_lookup.Qtr)},

Outlet_Lookup.Shop_name,

Article_Color_Lookup.Article_label,

sum(Shop_facts.Amount_sold),

Calendar_year_lookup.Mth,
Article_Color_Lookup.Color_label
FROM
Calendar_year_lookup,
Outlet_Lookup,
Article_Color_Lookup,
Shop_facts
WHERE
( Outlet_Lookup.Shop_id=Shop_facts.Shop_id )
AND ( Article_Color_Lookup.Article_id=Shop_facts.Article_id and
Article_Color_Lookup.Color_code=Shop_facts.Color_code )
AND ( Shop_facts.Week_id=Calendar_year_lookup.Week_id )
GROUP BY

Calendar_year_lookup.Yr,

{fn concat('Q',Calendar_year_lookup.Qtr)},

Outlet_Lookup.Shop_name,

Article_Color_Lookup.Article_label,

Calendar_year_lookup.Mth,
Article_Color_Lookup.Color_label
ORDER BY
1 DESC,
5 DESC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top