select avg(price) price 
from pc a,product b
where a.model = b.model and b.make = 'd';select avg(price) price 
from laptop a,product b
where a.model = b.model and b.make = 'd';

解决方案 »

  1.   

    如果你要所D厂所有产品的平均价,那么:
    select avg(price) price
    from
    (select price 
    from pc a,product b
    where a.model = b.model and b.make = 'd'
    union all
    select price 
    from laptop a,product b
    where a.model = b.model and b.make = 'd') as T
      

  2.   

    如果用一句Sql如下:
    Select avg(price) price
    from product a,pc b
    where a.model=b.model and a.make='d'
    union all
    (select avg(price)
     from product a,laptop l
     where a.model=l.model and a.make='d'
      )