cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
675
Views
0
Helpful
2
Replies

SQL Command (Count)

jeremy.worden
Level 1
Level 1

Hi,

 

Looking for some help with running an SQL command to count the number of trunks. This will return the count of most of the trunks:

 

run sql select count(tm.name) as Total from device as d inner join typemodel as tm on d.tkmodel = tm.enum where tm.name like '%Trunk%'

 

However I have a situation where I have multiple trunks with the same name but different Route Groups. This does not count the duplicates.

 

Basically looking for the cli equivalent of Device>Trunks

 

Thanks!

1 Accepted Solution

Accepted Solutions

Aaron Harrison
VIP Alumni
VIP Alumni

Hey

Count:

run sql select count(*)  from routegroupdevicemap join device d on fkdevice = d.pkid join routegroup rg on fkroutegroup = rg.pkid

Check:

run sql select rg.name,d.name from routegroupdevicemap join device d on fkdevice = d.pkid join routegroup rg on fkroutegroup = rg.pkid

Regards


Aaron

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!

View solution in original post

2 Replies 2

Aaron Harrison
VIP Alumni
VIP Alumni

Hey

Count:

run sql select count(*)  from routegroupdevicemap join device d on fkdevice = d.pkid join routegroup rg on fkroutegroup = rg.pkid

Check:

run sql select rg.name,d.name from routegroupdevicemap join device d on fkdevice = d.pkid join routegroup rg on fkroutegroup = rg.pkid

Regards


Aaron

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!

Aaron, 

thanks for looking at this for me! so this is getting closer. now i seem to be missing trunks that dont have a route group assign (NULL). I have the same scenerio when trying to count CTI route points.

Thanks!

Jeremy