Oracle使用须要注意的一些技巧

使用or时,Oracle会将or左右的语句视为两个分别查询,以下方语句io

select * from T_JC_tools where jc_id='11024418' and eff_Station is null or eff_station='北京' and  jc_id='11024418' and delete_time is null;select

实际中会将前面和后面总体分割开im

select * from T_JC_tools where (jc_id='11024418' and eff_Station is null )or (eff_station='北京' and  jc_id='11024418' and delete_time is null);查询

因此咱们须要在or查询的条件先后加上()保证查询的准确性tools

select * from T_JC_tools where jc_id='11024418' and (eff_Station is null or eff_station='北京') and  jc_id='11024418' and delete_time is null;time

相关文章
相关标签/搜索