in reply to Re^2: Calculating the range between two numbers
in thread Calculating the range between two numbers

If you're going to be using 'IN' a lot, and the set changes, but have a high likelyhood of having the same number of values, you may get better performance by using bind variables. (although, in the cases of numeric ranges, use 'BETWEEN' or <= and >=)

my @set = ($c .. $d); my $sql = 'SELECT type FROM dog WHERE number IN ( ?'.(',?' x $#set).') '; my $sth = $db->prepare($sql) $sth->execute(@set);