问题遇到的现象和发生背景
MySQL 如何修改SQL语句,去掉语句中的or,因为有or导致索引失效
问题相关代码,请勿粘贴截图
select bid from book a ,querybook b where ( b.bname in (a.bname) or b.bname = "" ) and
(b.bauthor in (a.bauthor) or b.bauthor = "" ) and
(b.barea in (a.barea) or b.barea = "" )
SQL作用是当查询条件为空时默认查询全部数据,不为空是则按照条件进行查询