~鱼哀歌吧 关注:2贴子:96
  • 1回复贴,共1

SQL语句的意见基本知识

只看楼主收藏回复

or和AND的区别
or 是逻辑或,只要满足一个就可以
and是逻辑与,需要全部满足
例:
错误的
where
itemid01= 24717 and itemid01= 24718
正确的
where
itemid01= 24717 or itemid01= 24718


1楼2016-02-03 08:04回复
    关于操作符BETWEEN
    范围值
    错误的
    WHERE
    ItemId03 BETWEEN 27145 and 27147 or ItemId03 BETWEEN 27401 and 27403 or
    正确的
    WHERE
    (ItemId03 BETWEEN 27145 and 27147) or
    (ItemId03 BETWEEN 27401 and 27403) or


    2楼2016-02-03 08:04
    回复