> SELECT * FROM maintable WHERE key IN stuff; Thanks for that tip. Didn't know you could do that. Can't remember this as standard SQL.
RBS -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 28 January 2008 12:40 To: sqlite-users@sqlite.org Subject: Re: [sqlite] Number of elements in IN clause Felix Radensky <[EMAIL PROTECTED]> wrote: > Hi, > > Is there any limitation on the number of elements in IN clause ? > Can one have, e.g. thousands of elements ? Also, can having > to many elements become inefficient at some point and one > has to use some other technique, i.e. comparing elements one > by one in a loop ? > You can create a table that contains the elements that you would normally put in your IN clause: CREATE TEMP TABLE stuff(x); INSERT INTO stuff VALUES('one'); INSERT INTO stuff VALUES('two'); .... INSERT INTO stuff VALUES('one million'); Then run your query this way: SELECT * FROM maintable WHERE key IN stuff; -- D. Richard Hipp <[EMAIL PROTECTED]> ---------------------------------------------------------------------------- - To unsubscribe, send email to [EMAIL PROTECTED] ---------------------------------------------------------------------------- - ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------