我执行一个SQL:select ah.*,drc.type from view_all_house ah left join dc_relation_cunstom drc on drc.assets_type=ah.houseType and drc.assets_id=ah.id的出来的效果是
id houseType c_type type
1 1 0 1
2 2 0 1
3 3 0 2
当时我想要c_type显示是type的值,怎么弄
id houseType c_type type
1 1 1 1
2 2 1 1
3 3 2 2
id houseType c_type type
1 1 0 1
2 2 0 1
3 3 0 2
当时我想要c_type显示是type的值,怎么弄
id houseType c_type type
1 1 1 1
2 2 1 1
3 3 2 2
解决方案 »
- 求助:conn sys/sys@orcl
- 在oracle中如何进入企业管理器
- 菜鸟问下, 这个oracle的分页存储过程 SQLTools 怎样执行下
- oo4o的问题请教大虾们,高分重谢
- 为什么我用dba身份连接数据库就说,oracle还没有连接?
- 急!!!!!!!!!!!!!!oracle数据库应用
- [求助]在存贮过程中的查询语句如何让它实现动态条件查询?
- JDK1.3 和JDK1.4这两个环境下,连接Oracle数据库有什么区别?报错:java.lang.NoClassDefFoundError: java/sql/Savepoint
- 关于ORACLE中如何取最后几条记录的问题
- 导出oracle某个数据库的全部表结构包括外键等
- 数据库管理基础,imp导入表
- left join剩余的列想获取该如何写
from view_all_house ah
left join dc_relation_cunstom drc on drc.assets_type = ah.houseType
and drc.assets_id = ah.id
select ah.id, ah.houseType,drc.type c_type,drc.type from view_all_house ah left join dc_relation_cunstom drc on drc.assets_type=ah.houseType and drc.assets_id=ah.id
id houseType type
这三列不就行了吗
应该我做JAVA,对象只会映射ah里的元素!
select ah.id,ah.houseType,decode(c_type,0,drc.type,c_type) c_type,
drc.type
from view_all_house ah left join dc_relation_cunstom drc on drc.assets_type=ah.houseType and drc.assets_id=ah.id
select ah.id,ah.houseType,drc.type c_type,drc.type from view_all_house ah left join dc_relation_cunstom drc on drc.assets_type=ah.houseType and drc.assets_id=ah.id
ah 与其它表的连接查询,结果没法取到?如果取不到,上面的回答没一个可以用
如果能取到,直接替换c_type 为 type 就行了