Monday, March 19, 2012

Another simple SQL query (MS Access)

Hi. I'm having trouble doing another SQL query. It needs to compare a height against the average height of a group. If it is larger, than it is shown. I can create the sub query but it returns an error when going to the outer query.

Select avg(height)
from Materials
group by MCode

What is an outer query that would compare a single height against that groups average height and display the rows if the single height is greater?oh yeah, another thing. My outer query select can only have 2 columns (material, height)|||select material
, height
from Materials ZZ
where height
> ( select avg(height)
from Materials
where MCode = ZZ.MCode )

No comments:

Post a Comment