select t.bh1
,t.name1
,t.content
,t.deductDescn
,a.score as cbsscore
,b.score as jlscore
,c.score as yzscore
from
(Select cgat.id as itemId
,Case When cgat.code='GCZZ' Then '一'
Else
Case When cgat.code='GCZL' Then '二'
Else
Case When cgat.code='GCJD' Then '三'
Else
Case When cgat.code='AQWM' Then '四'
Else
cgat.code
End
End
End
End bh1
,Name || '(' || cgat.score || ')' As name1
,Name || '(' || cgat.score || ')' As content
,Name || '(' || cgat.score || ')' As Deductdescn
,Name || '(' || cgat.score || ')' As name4
,Name || '(' || cgat.score || ')' As contentCode
,Name || '(' || cgat.score || ')' As name6
,treecode
From ip_ct_goodJob_assessType cgat
Where
length(treeCode)=5
and name<>'加分因素'
And contractType='XMHT_SG_HT'
union
select cgai.id as itemId
,cgat1.code as bh2
,cgat1.name || '(' || cgat1.score || ')' as name2
,cgai.content as content
,cgai.Deductdescn as Deductdescn
,cgai.contentCode
,'' name3
,''name4
,cgat1.treecode || '000' ||cgai.contentCode as treecode
from ip_ct_goodJob_assessItem cgai
,ip_ct_goodJob_assessType cgat1
,ip_ct_goodJob_assessType cgat2
where
cgai.assessTypeId=cgat1.id
and cgai.activity = 1
and cgat2.activity =1
and cgat1.contracttype='XMHT_SG_HT'
and cgat2.contracttype='XMHT_SG_HT'
and cgat1.parentid=cgat2.id
and cgat1.name<>'加分因素'
) t
left join
(
select cgjd.itemid
,cgjd.score
from ip_ct_goodJob cgj
,ip_ct_goodJob_detail cgjd
where
cgj.id=cgjd.goodjobid
and cgj.postid='contractor'
and cgj.id=''
and cgj.contractid=''
) a
on t.itemId=a.itemid
left join
(
select cgjd.itemid
,cgjd.score
from ip_ct_goodJob cgj
,ip_ct_goodJob_detail cgjd
where
cgj.id=cgjd.goodjobid
and cgj.postid='supervisor'
and cgj.id=''
and cgj.contractid=''
) b
on t.itemId=b.itemid
left join
(
select cgjd.itemid
,cgjd.score
from ip_ct_goodJob cgj
详细解决方案
oracle 查询两段数据Union不已。出现什么未正确结束 求高手指导。
热度:62 发布时间:2016-04-24 07:03:19.0
相关解决方案
- oracle 分页排序,ssi,该怎么处理
- oracle 最近的时间(而不是前一天的时间) 跪求sql语句 。解决方法
- oracle,该怎么解决
- oracle 安装时出现 java tm 异常
- android访问其他数据库(如:oracle、MySql等),希望大家给点建议!解决方案
- oracle 安插 LONG VARCHAR 类型数据
- oracle loadjava如何用
- oracle,该如何处理
- C# + SQL server +oracle QQ交流群142703980解决方法
- VS10连接Oracle的有关问题:"Oracle.DataAccess.Client.OracleConnection"的类型初始值设定项引发错误
- Oracle-参数查询有关问题
- oracle,insert 语句插入一条记录后要求,返回主键id値。解决思路
- 多个表的合并后(union all),怎么获得前 10 条记录?
- Oracle 10g下的SQL语句,有点难度.请~[同时向朋友们道歉~]
- 月统计(oracle)解决办法
- 在线紧急等一sql语句(oracle),该怎么处理
- oracle 连接数据库该如何写语句的
- oracle 客户端链接服务端的方式?该如何解决
- Oracle select后表的最左首的数字
- Oracle 服务器字符集和pl/sql字符集有关问题,
- Oracle DBA解决方案
- oracle 中表名的连接解决方法
- oracle 老鸟进,新人求指点解决方法
- oracle 恢复删除的表,该怎么解决
- oracle 数据自动增长,该怎么解决
- 求推荐数据库脚本编纂的书籍(oracle)
- oracle 数据库,该如何解决
- oracle 用室外部验证
- 高分寻 oracle 锁机制 并行安插表数据数量的控制方法
- oracle 中表名的联接