查询语句

来源:互联网 发布:java计算器单选按钮 编辑:程序博客网 时间:2024/05/21 15:34

select * from 商品 where( (商品类别=1) or (商品类别=2) or (商品类别=3) or (商品类别=6))
商品类别指的是粮食,五金,电子,蔬菜,水果,等等这样的类别

create table test(idint identity(1,1),colvarchar(100))

insert into test(col)

select top10000'a'from sysobjects across join sysobjects b

--第一种情况select* from testwhere id in (1,2,3,6)

--第二种情况select* from testwhere id=1or id=2or id=3or id=6

--第三种情况select* from testwhere id=1union all

                      select* from testwhere id=2union all

                      select* from testwhere id=3union all

                       select* from testwhere id=6

原创粉丝点击