sql or 语句优化问题
发布网友
发布时间:2022-04-13 11:18
我来回答
共3个回答
热心网友
时间:2022-04-13 12:47
试试这个:
SELECT * FROM get_childs1('1')
WHERE addorgid=childid
OR receiveorgid=childid
OR sendorgid=childid
OR adddeptid =childid
OR senddeptid =childid
OR receivedeptid=childid
改成:
SELECT * FROM get_childs1('1')
WHERE childid in(addorgid,receiveorgid,sendorgid,adddeptid,senddeptid,receivedeptid)
热心网友
时间:2022-04-13 14:05
如果字段有索引的话
把你的or
替换成union all
试试看吧