在CUCM(11.5)中的SQL查询之后,cli返回以下结果:
device number loggedin_to_lg linegroup
=============== =============== ============== ======================================
CSFABCDEF \+49325874147 f LG-HG_BER01_49325874147
CSFRFETRS \+49325800848 f LG-HG_BER01_493225800848
run sql select d.name as Device, n.dnorpattern as Number, dhd.hlog as LoggedIn_to_LG, lg.name as LineGroup
from linegroup as lg
inner join linegroupnumplanmap as lgmap on lgmap.fklinegroup=lg.pkid
inner join numplan as n on lgmap.fknumplan = n.pkid
inner join devicenumplanmap as dmap on dmap.fknumplan=n.pkid
inner join device as d on dmap.fkdevice=d.pkid
inner join devicehlogdynamic as dhd on dhd.fkdevice=d.pkid
order by lg.name
但是,如果我们尝试将另一个表-extensionmobilitydynamic-内部连接到此查询并显示其中一个列,则返回时没有结果。
run sql select d.name as Device, n.dnorpattern as Number, dhd.hlog as LoggedIn_to_LG, lg.name as LineGroup, e.datetimestamp
from linegroup as lg
inner join linegroupnumplanmap as lgmap on lgmap.fklinegroup=lg.pkid
inner join numplan as n on lgmap.fknumplan = n.pkid
inner join devicenumplanmap as dmap on dmap.fknumplan=n.pkid
inner join device as d on dmap.fkdevice=d.pkid
inner join devicehlogdynamic as dhd on dhd.fkdevice=d.pkid
inner join extensionmobilitydynamic as e on e.fkdevice = d.pkid
order by lg.name
答案 0 :(得分:0)
找不到任何匹配的行,因此INNER JOIN无法检索任何内容。您必须尝试新表的左连接,否则可能没有匹配的结果。在这种情况下,结果列将为NULL。
run sql select d.name as Device, n.dnorpattern as Number, dhd.hlog as LoggedIn_to_LG, lg.name as LineGroup, e.datetimestamp
from linegroup as lg
inner join linegroupnumplanmap as lgmap on lgmap.fklinegroup=lg.pkid
inner join numplan as n on lgmap.fknumplan = n.pkid
inner join devicenumplanmap as dmap on dmap.fknumplan=n.pkid
inner join device as d on dmap.fkdevice=d.pkid
inner join devicehlogdynamic as dhd on dhd.fkdevice=d.pkid
left join extensionmobilitydynamic as e on e.fkdevice = d.pkid
order by lg.name