Oracle表另命名的问题

select count(*) as num from IS_ContractHis a,(select b.IID,a.SModel,sum(a.ISetts) as tsetts,sum(b.FTOTALAMOUNT) as NFTOTALAMOUNT from IS_ContractOrder a ,IS_Contract b where a.IID=b.IID group by b.IID,a.SModel) b where a.IID=b.IID and b.? like '%ll%'
我想知道我标致了?的那个b表所代表的是语句中那个表?
多谢!!

0

3个回答

是这个子查询的结果集:
code="sql" as tsetts,
sum(b.FTOTALAMOUNT) as NFTOTALAMOUNT
from IS_ContractOrder a, IS_Contract b
where a.IID = b.IID
group by b.IID, a.SModel)
[/code]

其实你把语句在PL/SQL中Beautifier一下就很容易看出来啦:
[code="sql"]
select count(*) as num
from IS_ContractHis a,
(select b.IID,
a.SModel,
sum(a.ISetts) as tsetts,
sum(b.FTOTALAMOUNT) as NFTOTALAMOUNT
from IS_ContractOrder a, IS_Contract b
where a.IID = b.IID
group by b.IID, a.SModel) b
where a.IID = b.IID
and b.? like '%ll%'
[/code]

0

IS_Contract b

0
weixin_42502043
呗呗、¢ 嗯! b后面的括号里面的内容
6 年多之前 回复
jinnianshilongnian
jinnianshilongnian 粗心了, 是这个 (select b.IID,a.SModel,sum(a.ISetts) as tsetts,sum(b.FTOTALAMOUNT) as NFTOTALAMOUNT from IS_ContractOrder a ,IS_Contract b where a.IID=b.IID group by b.IID,a.SModel) b
6 年多之前 回复

b代表整个子查询结果集。通过SQL的格式化工具将SQL Format一下就很直观了。
BTW: like '%ll%'这样写效率啊……

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!