Showing posts with label average. Show all posts
Showing posts with label average. Show all posts

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 )

Sunday, March 11, 2012

another query question

Hi,
How do you do this in Pubs?
Select the types of books that had an average price > $13.50
I can only go so far:
select type, avg(price) from titles group by typenospam
select type, avg(price) from titles
group by type
HAVING avg(price) >13
"nospam" <hello@.hotmail.com> wrote in message
news:TuOdnavPvLGCLciiRVn-hA@.giganews.com...
> Hi,
> How do you do this in Pubs?
> Select the types of books that had an average price > $13.50
>
> I can only go so far:
> select type, avg(price) from titles group by type
>