【发布时间】:2011-03-19 20:13:16
【问题描述】:
这是需要转成Oracle 11g的sql server脚本:
select p.locale, q.everecondis, [0] as No, [1] as Yes,
[0]* 100.0/([0] + [1]) as [pctNo],
[1]* 100.0/([0] + [1]) as [pctYes]
from
(select p.locale, q.everecondis, s.enr1yr
from s, q, p
where s.student_info_key = q.student_info_key
and s.pse_school_key = p.pse_school_key and s.enr1yr >=1) as tbl
pivot
(count(enr1yr) for enr1yr in ([0],[1])) as pvt
order by locale, everecondis
如何让它在 Oracle 11g 上的 PL/SQL 中运行? (PL/SQL 新手)
【问题讨论】:
-
您的(具体)问题是什么?
-
如何把它转成PL/SQL在Oracle 11g上运行?
-
尝试在 Oracle 中运行它,并修复任何损坏的地方。两者都是基于 SQL 的,所以基础是一样的。特定于供应商的功能/约定会有所不同。所以只要修复任何不一样的功能。
-
该查询实际上没有意义。您拥有
s.enr1yr >=1,但正在以enr1yr in (0,1)为中心 -
@chris:请自行评论答案,而不是将 cmets 编辑到您的问题中。您可以评论自己问题的答案; 50 rep 的要求仅适用于其他人的问题和其他人的答案。
标签: sql sql-server plsql