我在表名 ActionFlag 中有一个列,其中包含诸如“N”、“R”和“A”之类的值,但是当我尝试查询此语句时,什么都没有出现?
select tblFtpTrans.*,tblLocs.unit from tblFtpTrans left join tblLocs on
tblFtpTrans.location=tblLocs.location where tblFtpTrans.id>0 and actiondate>='2020-06-01' and
actiondate<='2020-07-30' and actionflag='N' AND ActionFlag='A'
样本数据
NumId WorkId EightId Num ActionFlag
24803 17944 7683 0 N
24804 17940 5076 0 A
24805 17896 7684 0 A
24806 17904 7685 0 B
24807 17868 7686 0 R
这就是我要的
NumId WorkId EightId Num ActionFlag
24803 17944 7683 0 N
24804 17940 5076 0 A
24805 17896 7684 0 A
只需使用in
:
select t.*, l.unit
from tblFtpTrans t left join
tblLocs l
on t.location = l.location
where t.id > 0 and
actiondate >= '2020-06-01' and
actiondate <= '2020-07-30' and
actionflag in ('N', 'A')
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句