如何处理各种条件的更新记录? [英] How to deal with update records with various conditions?
本文介绍了如何处理各种条件的更新记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
sql = "update [note] " & _
" set flag='on' " & _
" where doc_type='credit' " & _
" and doc_type='debit' and doc_no like " & "'" & text1 & "%'"
虽然我在数据库中有记录,但此代码不会返回任何结果...
This code doesn''t return any result though I''m having records in database...
DOC_NO DOC_TYPE RETURN FLAG
121001 DEBIT off //on
666 CREDIT 121002 off //on
122004 DC off
888 CREDIT 121005 off //on
122006 DC off
现在我想在那些记录上打开''on'
[1]贷记和
[2]借记以及doc_no ='''121%''(例如,text1有121种类型)
我试过上面的代码不是工作...任何人都可以帮助我.....
Now I want to make flag ''on'' of those records which are
[1] credited and
[2] debited as well as having doc_no=''121%''(for ex. text1 has 121 typed)
I tried above code which is not working ...can anyone help me.....
推荐答案
你不能在一个命令中做到这一点!为什么?请阅读ryanb31评论。
1)
You can''t do it in one command! Why? Please, read ryanb31 comment.
1)
UPDATE [note] set flag="on"
WHERE doc_type="credit"
2)
2)
UPDATE [note] set flag="on"
WHERE doc_no like "121*"
请点击以下链接:查询示例条件(MS Access) [ ^ ]
这篇关于如何处理各种条件的更新记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文