J
Jim
I'm looking for a suggestion. As part of an ap, I have to find a set of
records with a very large number of conditions and am wondering if there is
a "best" or standard way to handle such a query.
There is a category ID field, and I need to select all the records that
match the category. But there can be anywhere from 1 to 100 or more category
IDs (don't know how many or which until runtime) whose records I need to
find. The result is used to dynamically update a control as a user interacts
with it, so needs to be as quick as possible.
I could use a loop and construct a WHERE clause and concantenate a bunch of
OR conditions, but that's seems like it may be too many/long or perhaps
really ineffecient. (WHERE ID=10 OR ID=12 OR ID=30 OR....)
Or would a long IN condition work or be better, like WHERE ID IN (ID1, ID2,
ID3, ID4....). Would there be any difference in execution?
Another idea is to code a loop where each iteration executes an append query
for each ID. But then I'm running up to 100 seperate queries, which also
raises effeciency issues.
Thanks much!
Jim
records with a very large number of conditions and am wondering if there is
a "best" or standard way to handle such a query.
There is a category ID field, and I need to select all the records that
match the category. But there can be anywhere from 1 to 100 or more category
IDs (don't know how many or which until runtime) whose records I need to
find. The result is used to dynamically update a control as a user interacts
with it, so needs to be as quick as possible.
I could use a loop and construct a WHERE clause and concantenate a bunch of
OR conditions, but that's seems like it may be too many/long or perhaps
really ineffecient. (WHERE ID=10 OR ID=12 OR ID=30 OR....)
Or would a long IN condition work or be better, like WHERE ID IN (ID1, ID2,
ID3, ID4....). Would there be any difference in execution?
Another idea is to code a loop where each iteration executes an append query
for each ID. But then I'm running up to 100 seperate queries, which also
raises effeciency issues.
Thanks much!
Jim