现表 T1 有如结构:c_person type
001 A
002 A
001 B
001 c
001 d
002 c把 c_person 中 type 为A 和C的记录找出来请问是否用 type ='A' or type='C' 就能满足条件了?
001 A
002 A
001 B
001 c
001 d
002 c把 c_person 中 type 为A 和C的记录找出来请问是否用 type ='A' or type='C' 就能满足条件了?
insert into person
select '001','A' union all
select '002','A' union all
select '001','B' union all
select '001','D' union all
select '002','C' union allSELECT * FROM person
WHERE type='A' OR TYPE ='C'
SELECT * FROM person
WHERE type IN ('A','C')
union all
select * from person where type='C'
insert into @person
select '001','A' union all
select '002','A' union all
select '001','B' union all
select '001','c' union all
select '002','d' union all
select '002','c'select *
from @person
where type='A' or type='C' --'c'和'C'默认不区分大小写
--结果
c_person type
001 A
002 A
001 c
002 c
select *
from @person
where type='A' or type='C' COLLATE Chinese_PRC_CS_AS --'c'和'C'区分大小写
--结果
c_person type
001 A
002 A
WHERE type='A' OR TYPE ='C'
SELECT * FROM person
WHERE type IN ('A','C')
WHERE type='A' and TYPE ='C'
把OR改成AND 会找什么呀
IN 次之,OR 本人用的很少 经常查询造成不准确,最主要的是容易被人注入