当前位置: 代码迷 >> Sql Server >> 这个SQL语句该怎样修改?解决方法
  详细解决方案

这个SQL语句该怎样修改?解决方法

热度:32   发布时间:2016-04-27 16:58:55.0
这个SQL语句该怎样修改?
select   *   from   table   where   a   between   1   and   156  


但现在只想查找为双数的记录?

select   *   from   table   where   a   in(2,4,6,8,10...........)
这样太长了..




------解决方案--------------------
select * from table where a%2=0 and a <=156
------解决方案--------------------
select * from table where a between 1 and 156
and a%2=0
------解决方案--------------------
同意wym840713()这位兄弟的select * from table where a between 1 and 156 and a%2=0,另一位兄弟的select * from table where a%2=0 and a <=156可以取到0,这点不符合你的要求
  相关解决方案