Saw the post was 2 years ago and no solution update. This should help others who would need this kind of query for cucm 8.6:
run sql select device.name,device.description,device.tkmodel,device.pkid from device,devicexml4k where device.name like "%SEP%" and device.tkmodel=585 and device.pkid=devicexml4k.fkdevice and devicexml4k.xml like "%<videoCapability>1</videoCapability>%"
the query looks horrible and can be impoved but it gets the job done :). This seaches for device model Cisco 8945 specifically.