select distinct sj from ta
where
sj>='2008-1-1 7:30:00' and sj <='2008-1-1 19:29:59'
and
(
(bm='001' and x=1)
or
(bm='002' and xz=2)
or
bm=003
)
where
sj>='2008-1-1 7:30:00' and sj <='2008-1-1 19:29:59'
and
(
(bm='001' and x=1)
or
(bm='002' and xz=2)
or
bm=003
)
把且改成AND ,把或者改成OR ,把','改成().
如 1楼所说:sj>='2008-1-1 7:30:00' and sj <='2008-1-1 19:29:59'
and
(
(bm='001' and x=1)
or
(bm='002' and xz=2)
or
bm=003
)
如:select * from database where (A='001' OR A='002') AND B='003' 等价于:
select * from database where (A='001' AND B='003') OR (A='002' AND B='003')我这样理解对吗