 delete from entPhysical where deleted != 'NULL';

# select
#  devices.hostname,
#  ports.ifName,
#  ports.port_descr_descr,
#  ports.ifAdminStatus,
#  ports.ifOperStatus,
#  entPhysical.entPhysicalVendorType,
#  entPhysical.entPhysicalDescr,
#  entPhysical.entPhysicalSerialNum
# from
#  ports
#   Inner Join devices        On devices.device_id = ports.device_id
#   Inner Join entPhysical    On entPhysical.device_id = ports.device_id
#                            And ( entPhysical.entPhysicalName = ports.ifName
#                             Or   entPhysical.entPhysicalName = ports.port_label 
#                             Or   entPhysical.entPhysicalName = CONCAT(ports.ifname, '(volt)')
#                                )
# where entPhysicalSerialNum != '';

 select 
  devices.hostname,
  ports.ifName,
  ports.ifAdminStatus,
  ports.ifOperStatus,
  entPhysical.entPhysicalDescr,
  entPhysical.entPhysicalSerialNum
from 
 ports
   Inner Join devices        On devices.device_id = ports.device_id
   Inner Join entPhysical    On entPhysical.device_id = ports.device_id
                            And ( entPhysical.entPhysicalName = ports.ifName
                            Or   entPhysical.entPhysicalName = ports.port_label
                            Or   entPhysical.entPhysicalName = CONCAT(ports.ifname, '(volt)')
                                )
where 
  (entPhysicalClass = "port"   and entPhysicalDescr like "%SFP%") or
  (entPhysicalClass = "module" and entPhysicalDescr like "%SFP%") or
  (entPhysicalClass = "sensor" and entPhysicalDescr like "%volt%") or
  (entPhysicalClass = "port"   and entPhysicalIsFRU = "true") 
  

;

# select * from entPhysical where    (  (entPhysicalClass = "port"   and entPhysicalDescr like '%SFP%') or  (entPhysicalClass = "module" and entPhysicalDescr like
#'%SFP%') or  (entPhysicalClass = "sensor" and entPhysicalDescr like '%volt%')  );


# select * from entPhysical where (entPhysicalClass = "module" or entPhysicalClass = "port")and entPhysicalDescr like "%SFP%";

