联合查询排序问题
时间:2011-12-15
来源:互联网
*
from
( Select
o.Net_Id As "netId",
o.Use_Person As "usePerson",
o.Use_Date As "useDate",
o.Use_Type As "useType",
i.Use_Person As "usePerson1",
i.Use_Date As "useDate1",
i.Use_Type As "useType1",
'' As "applyPerson",
Null As "applyDate",
'' As "newStatus"
From
Net_Pki o,
Net_Pki i
Where
o.Id = i.Use_Id (+)
And o.use_type = 'O'
And o.Net_Id='201104140010'
Union
Select
s.Ass_No As "netId",
'' As "userPerson",
Null As "useDate",
'' As "useType",
'' As "userPerson1",
Null As "userDate1",
'' As "useType1",
s.Apply_Person As "applyPerson",
s.Apply_Date As "applyDate",
s.New_Status As "newStatus"
From
Ass_Status_Apply s
Where
s.Ass_No = '201104140010'
And s.New_Status='BF'
)
Order by
ID ASC
在oracle数据库中查询时,报 ID:无效标示符
我在 Select
o.Net_Id As "netId", 中间加了一个o.Id Ad "id" 报查询块具有不正确的结果列数 这个应该怎么改 才能让最后查询出来的数据按照ID升序排列
作者: wyk0617 发布时间: 2011-12-15
作者: xpingping 发布时间: 2011-12-15
作者: LuiseRADL 发布时间: 2011-12-15
select * from ( Select o.Net_Id As "netId", [color=#FF0000]o.Id As "id",[/color] o.Use_Person As "usePerson", o.Use_Date As "useDate", o.Use_Type As "useType", i.Use_Person As "usePerson1", i.Use_Date As "useDate1", i.Use_Type As "useType1", '' As "applyPerson", Null As "applyDate", '' As "newStatus" From Net_Pki o, Net_Pki i Where o.Id = i.Use_Id (+) And o.use_type = 'O' And o.Net_Id='201104140010' Union Select s.Ass_No As "netId", [color=#FF0000]……[/color] '' As "userPerson", Null As "useDate", '' As "useType", '' As "userPerson1", Null As "userDate1", '' As "useType1", s.Apply_Person As "applyPerson", s.Apply_Date As "applyDate", s.New_Status As "newStatus" From Ass_Status_Apply s Where s.Ass_No = '201104140010' And s.New_Status='BF' ) Order by "id" ASC
红色部分要对应
作者: xpingping 发布时间: 2011-12-15
作者: LuiseRADL 发布时间: 2011-12-15
select
*
from
( Select
o.Net_Id As "netId",
o.Use_Person As "usePerson",
o.Use_Date As "useDate",
o.Use_Type As "useType",
i.Use_Person As "usePerson1",
i.Use_Date As "useDate1",
i.Use_Type As "useType1",
'' As "applyPerson",
Null As "applyDate",
'' As "newStatus"
From
Net_Pki o,
Net_Pki i
Where
o.Id = i.Use_Id (+)
And o.use_type = 'O'
And o.Net_Id='201104140010'
Union
Select
s.Ass_No As "netId",
'' As "userPerson",
Null As "useDate",
'' As "useType",
'' As "userPerson1",
Null As "userDate1",
'' As "useType1",
s.Apply_Person As "applyPerson",
s.Apply_Date As "applyDate",
s.New_Status As "newStatus"
From
Ass_Status_Apply s
Where
s.Ass_No = '201104140010'
And s.New_Status='BF'
)
Order by
ID ASC
在oracle数据库中查询时,报 ID:无效标示符
这个列数是一样的啊 为什么报ID标示符无效就是排序的时候
作者: wyk0617 发布时间: 2011-12-15
作者: xpingping 发布时间: 2011-12-15
作者: wyk0617 发布时间: 2011-12-15
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28