SQL判空问题
select username
from (select distinct substr(c.circuitname,
0,
(instr(c.circuitname, '_', 1, 1)) - 1) username
from node n, userinfo u, device d, portinfo p, circuit c
where u.netuserid = 'admin'
and n.nodefullcode like '%' || u.nodecode || '%'
and d.nodecode = n.nodecode
and d.changetype = 0
and c.changetype = 0
and p.deviceid = d.deviceid
and ((c.adeviceid = d.deviceid and c.aintdescr = p.portdescr) or
(c.bdeviceid = d.deviceid and c.bintdescr = p.portdescr)))
where username is not null//加了这句后比不加慢了几十倍,请教各位高手,谢谢