I have a c# List intlist that contains (1,2,3,4,5)
I have a TABLE in a Sqlite db that also contains a int COLUMN with (1,2,3,4,5) as well as other fields
If I run a select using sqlite connection in c# like:
"SELECT COLUMN, COLUMN2 from TABLE where COLUMN in" + ('1','2','3','4','5');
it executes in < .001 sec But it requires me to type each value into the statement as above, when I already have that data in a list
So instead if I iterate over the list and run the same query like:
foreach (int i in intlist) {
"SELECT COLUMN, COLUMN2 from TABLE where COLUMN = " + i;
}
It runs 5 separate selects and takes > 1 sec
Obviously over large data sets this is amplified to the point it becomes unusable to iterate over and run all those selects. If I have 2,000 ints for example. I have tried batching the selects in transactions and it doesn't speed it up at all.
Is there some other way to iterate over a c# list and use values in that list in a Sqlite select? So I don't have to type them all in manually and can take advantage of the fact I already have the values in a list?