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'
(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'
解决方案 »
- 如何用一个SQL语句,实现把某列值组合成一个字串串?
- 关于sqlserver update触发器大数据量更新的问题,在线等
- 求一个查询语句,在orcale中很好实现,在sqlserver 中不知怎么办
- 紧急问题sql在线转access
- 求助!关于数据库被注入以后的清除问题!
- 请问:如何转换数据类型,从varchar到numeric??
- 如何设置才能在不显示【无法访问】数据库
- 请问: 我在sql server里做了一张表。 我想把我现有的文本里的数据导到数据库里。我应该怎么做?
- 如何在SQLSERVER2000的一个函数中定义一个常量啊?
- sql中定义自动增加的字段怎么做?
- 谁知道怎样用ADO或ADOX取SQL SERVER2000的扩展属性??
- 關於 Character Set
select laptop.model,pc.price from laptop,pc where laptop.hd ='a' and
laptop.model = pc.model
大概这样就行。
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
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
)
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