In article <[EMAIL PROTECTED]>,
Kamran <[EMAIL PROTECTED]> writes:

> Hello Jeff,
> Thanks a lot for your help.  It worked, but there is a slight
> adjustment. Note below:


> my $QRYstring = "select * from $tablename where id IN (" . join ("," ,
> @ids) . ")" ;

> I mean , join needed brackets as well. Other wise only last record was
> being matched or (NOT matched) based on the use of NOT in the outer
> query.

> Thanks again for your help.

> And thank you all for taking out time for this.

Please note that all suggestions posted are susceptible to SQL
injection attacks.  This means that your database can get damaged if
@ids comes from an external source.  A safe (albeit clumsy)
alternative would be

  my $sth = $dbh->prepare (q{
    SELECT id, str
    FROM tbl
    WHERE id NOT IN (
  } . join (',', '?' x @ids) . q{
                     )
  });

  $sth->execute (@ids);

Reply via email to