Cisco Unified Call Manager SQL查询

时间:2014-02-13 16:27:51

标签: sql cisco ucos cucm

我试图直接从cli查询调用管理器8.5+(最终我将把它放入axl)

目前我的查询看起来像这样

run sql select dp.name as Site, tm.name as Model, count(tm.name) as Total from Device as d inner join DevicePool as dp on(d.fkDevicePool = dp.pkid) inner join typemodel as tm on(tm.enum = d.tkmodel) where (tm.name <> 'Analog Phone' and tm.name <> 'Conference Bridge'  and tm.name <> 'CTI Route Point' and tm.name <> 'CTI Port' and tm.name <> 'MGCP Station' and tm.name <> 'Route List' and tm.name <> 'H.323 Gateway' and tm.name <> 'Music On Hold' and tm.name <> 'Media Termination Point' and tm.name <> 'Tone Announcement Player' and tm.name <> 'Cisco IOS Conference Bridge (HDV2)' and tm.name <> 'Cisco IOS Software Media Termination Point (HDV2)' and tm.name <> 'Cisco IOS Media Termination Point (HDV2)' and tm.name <> 'SIP Trunk') group by dp.name, tm.name order by dp.name

这导致了这个

site           model                             total
============== ================================= =====
SITE1-NUANCE-DP Third-party SIP Device (Advanced) 1
SITE1-PHONES-DP Cisco 8945                        351
SITE1-PHONES-DP Cisco 6941                        25
SITE1-PHONES-DP Cisco 7925                        310
SITE1-PHONES-DP Cisco 7937                        3
SITE1-PHONES-DP Cisco 8961                        293
SITE1-PHONES-DP Cisco IP Communicator             1
SITE2-PHSRST-DP Cisco 7937                        1
SITE2-PHSRST-DP Cisco 6941                        1
SITE2-PHSRST-DP Cisco 8961                        143
SITE2-PHSRST-DP Cisco 8945                        21

我真正想看到的是这样的事情

site           total
============== =====
SITE1-PHONES-DP 300
SITE2-PHONES-DP 350

我会在这里,我从网上搜索了解到我昨天知道的一点点sql。我不知道你是否可以进行字符串操作或任何东西,因为我真的想删除网站下的-phones-dp部分,但这并不重要。我只需要让查询允许数学不好的人获得一个数字。在目前的状态,他们必须添加可能是DISASTROUS的一切!任何帮助是极大的赞赏!谢谢!

1 个答案:

答案 0 :(得分:0)

根据你所说的,我会尝试这样的事情:

select dp.name as Site
,count(tm.name) as Total 
from Device as d 
inner join DevicePool as dp on(d.fkDevicePool = dp.pkid) 
inner join typemodel as tm on(tm.enum = d.tkmodel) 
where (
        tm.name <> 'Analog Phone' 
        and tm.name <> 'Conference Bridge'  
        and tm.name <> 'CTI Route Point' 
        and tm.name <> 'CTI Port' 
        and tm.name <> 'MGCP Station' 
        and tm.name <> 'Route List' 
        and tm.name <> 'H.323 Gateway' 
        and tm.name <> 'Music On Hold' 
        and tm.name <> 'Media Termination Point' 
        and tm.name <> 'Tone Announcement Player' 
        and tm.name <> 'Cisco IOS Conference Bridge (HDV2)' 
        and tm.name <> 'Cisco IOS Software Media Termination Point (HDV2)' 
        and tm.name <> 'Cisco IOS Media Termination Point (HDV2)' 
        and tm.name <> 'SIP Trunk'
    ) 
group by dp.name
order by dp.name