select distinct a.str_deductbill_no
from [sellrebate].dbo.t_deduct_account_detail a
where (a.str_bill_no not between '200812260000' and '200903259999')
and str_deductbill_no='200901070089'
order by str_deductbill_no 后面这个加上括号试一下.
from [sellrebate].dbo.t_deduct_account_detail a
where (a.str_bill_no not between '200812260000' and '200903259999')
and str_deductbill_no='200901070089'
order by str_deductbill_no 后面这个加上括号试一下.
select distinct a.str_deductbill_no
from [sellrebate].dbo.t_deduct_account_detail a
where str_deductbill_no='200901070089' and
a.str_bill_no not between '200812260000' and '200903259999'
order by str_deductbill_no
from [sellrebate].dbo.t_deduct_account_detail a where a.str_bill_no not between '200812260000' and '200903259999' and str_deductbill_no='200901070089'
再仔细说明一下,在[sellrebate].dbo.t_deduct_account_detail 表中有一个记录字段str_bill_no='200812250375'
他的 str_deductbill_no='200901070089'
大家看我的语句select distinct a.str_deductbill_no
from [sellrebate].dbo.t_deduct_account_detail a where a.str_bill_no between '200812260000' and '200903259999' and str_deductbill_no='200901070089'
查询时应该不会出现str_deductbill_no='200901070089'
但是现在就是有这个记录出现,所以不知道原因?谢谢大家回复!
select distinct a.str_deductbill_no
from [sellrebate].dbo.t_deduct_account_detail a where a.str_bill_no not between '200812260000' and '200903259999' and str_deductbill_no='200901070089' 结果也一样
from [sellrebate].dbo.t_deduct_account_detail a
where str_deductbill_no='200901070089' 检查一下有几条记录