SQL 中 or、and同时使用

版权声明: https://blog.csdn.net/qq_35193093/article/details/88394340

在测试程序的时候发现sql查询语句超过范围

检查sql语句发现原语句:select xx from xx where a=b and c=d or e=f;

预期的结果是满足a=b的同时c=d或者e=f,忘记加括号导致范围超限

加括号后select xx from xx where a=b and (c=d or e=f);

猜你喜欢

转载自blog.csdn.net/qq_35193093/article/details/88394340