SQL query - a solution to avoid IN (...) statement
Posted on 2009-06-29
I have a list of items in the ListBox. Next, i have to select records from a table, where one of the fields corresponds to the names in the ListBox.
1) I build a string like (name1, name2, name3,... nameN)
2) SQL = "SELECT * from myTable WHERE myTable.[myField IN " & mystring
it works fine, but I am not sure if it is a good solution for large lists, i.e. 2,000 items. I am getting a huge string IN
are there any other ways how to structure this?
should I be afraid of too long IN statement?