Hi, I'm trying to find the best and most efficient way to build a "select" query that uses "in" from C-code where the number of values in the list varies from query to query. The sql statement will look something like this:
select * from table1 where name in (name1... nameX) I've found two approaches that work: - Build the sql statement by creating a long string where the entire list is sprintf'd into a buffer and it is passed to sqlite3_prepare_v2 before calling sqlite3_step select * from table1 where name in (name1, name2, name3) - Build an argument string and put that in the sql statement before it goes to sqlite3_prepare_v2 select * from table1 where name in (?, ?, ?) then bind the values one by one using sqlite3_bind_text before calling sqlite3_step Both work, but as the values I'm searching for varies for each query both in the names and the number for names searched for reusing a prepared statement isn't possible. Is there a way I can prepare the select and supply a variable list of values to look for in a bind later on? Thanks, Carl _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users