当前输出:
PORT BANDWIDTH TYPE
XE-5/1/0 29267 XE
XE-5/1/0 48154 XE
GE-4/0/0 443 GE
XE-3/0/0 28077 XE
GE-1/0/0 1032 GE
GE-1/0/6 2285 GE
XE-5/1/0 XE查询:
select *
from (select d.port,d.bandwidth from dummy123 d where d.bandwidth is not null)
pivot (sum(bandwidth) as totalbandwidth for port in ( 'GE%' ,'XE%'))在使用pivot时,有没有办法使用like或%运算符?
发布于 2015-07-16 21:21:31
不,你不能。但是你可以使用substr来截断字符串。例如,尝试以下操作:
select *
from (select substr(d.port,1,2) portmask,
d.bandwidth
from dummy123 d where d.bandwidth is not null)
pivot (sum(bandwidth) as totalbandwidth for portmask in ( 'GE' ,'XE'))https://stackoverflow.com/questions/31455282
复制相似问题