我有两个货物类型表.
表 hw1 字段 id,name
表 hw2 字段 id,name
还有一个主表 hw1id,,hw2id,
hwm
问题是:主表中存放的是两个货物类型的id,想要通过视图显示货物名称.
表 hw1 字段 id,name
表 hw2 字段 id,name
还有一个主表 hw1id,,hw2id,
hwm
问题是:主表中存放的是两个货物类型的id,想要通过视图显示货物名称.
解决方案 »
- 急求linux9.0下oracle10的安装文件!!
- 修改geometry对象坐标,即sdo_ordinates可变数组里的值
- 一个有关pl/sql developer开发工具结构的问题!在线等待!!来者有分!!!
- 分页排序错乱的问题,搞得我很郁闷.大侠帮帮忙!
- oracle 中的键保留表
- proc 编译问题!高分回报加忠心的感谢。
- oracle插入大文本问题
- 请帮忙看看我的源码:为什么使用触发器更新父表汇总数据时,出错了呢?
- 想学习ORCALE,请指教!
- 有办法操作远程ACCESS数据库吗?
- Mapinfo的地图上载到Oracle的Spatial后为什么打开地图变得很慢
- 怎样转换中文日期格式
我有两个货物类型表.
表 hw1 字段 id,name
表 hw2 字段 id,name
还有一个主表 hwm 字段 hw1id,hw2id,
问题是:主表中存放的是两个货物类型的id,想要通过视图显示货物名称.
select a.hw1id as id,b.name from hwm a,hw1 b where a.hw1id=b.id
union all
select a.hw2id as id,b.name from hwm a,hw2 b where a.hw2id=b.id
/
hw1id,hw2id,所对应的名称要显示在两个字段中,不是在一个字段中
1 create view viewn
2 as
3 select t1.id as id1,t1.name as id1_name,t3.id as id2,t3.name as id2_name
4 from t1,t3,t4
5 where t1.id = t4.id1
6* and t3.id = t4.id2
SQL> /视图已建立。