select a.maker,b.model,b.price from product a,
(select model,price from pc 
union all
select model,price from laptop
union all
select model,price from printer
) b
where a.model=b.model and a.maker='A'

解决方案 »

  1.   

    这些表是什么呀?不说明一下?
    select laptop.model,pc.price from laptop,pc where laptop.hd ='a' and 
    laptop.model = pc.model
    大概这样就行。
      

  2.   

    select a.model,a.type,a.price
    from product a,
    (
    select model,price
    from pc
    union all
    select model,price
    from laptop
    union all
    select model,price
    from printer
    ) as b
    where a.model=b.model
      

  3.   

    select a.model,a.type,b.price
    from product a,
    (
    select model,price
    from pc
    union all
    select model,price
    from laptop
    union all
    select model,price
    from printer
    ) as b
    where a.model=b.model
    and a.maker='A'是不是这样可以:select model,price
    from pc
    where exists (
    select * from product
    where maker='A'
    and model=pc.model
    )
    union all
    select model,price
    from laptop
    where exists (
    select * from product
    where maker='A'
    and model=laptop.model
    )
    union all
    select model,price
    from printer
    where exists (
    select * from product
    where maker='A'
    and model=printer.model
    )
      

  4.   

    看看这个对不对
    select model,price from pc 
    inner join (
        select model from product where maker='A') as a 
    on a.model=pc.model
    union 
    select model,price from laptop
    inner join (
        select model from product where maker='A') as b 
    on b.model=pc.model
    union
    select model,price from printer 
    inner join (
        select model from product where maker='A') as c 
    on c.model=pc.model