返回列表 回復 發帖

關於模糊多條件查詢?

現在是利用迴圈的方式列出資料~但是好像很佔資源~請問該如何做比較好~~謝謝
PS. abc陣列有可能會有上百筆資料

abc = Array("aa", "bb", "cc", "dd", "ee")

For x = 0 To UBound(abc)
myrec.open "select * from table where column like '%" & abc(x) & "%' ", 1, , 3
''''
''''
'''
myrec.Close
Next x
簡單的方法是寫 SQL statement

sqlStr= "SELECT * FROM table WHERE column LIKE '%" & abc(0) & "%' "
For x = 0 To UBound(abc)
sqlStr= "AND column LIKE '%" & abc(x) & "%' "
Next x
myrec.open sqlStr, 1, , 3
myrec.Close

註:一定要小心 abc(x) 的值
謝謝你~受益良多~~~
返回列表 回復 發帖