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.
Best,
Kamran
On Tue, 2004-09-28 at 00:26, Jeff Zucker wrote:
> Kamran wrote:
>
> >
> > my @ids = (1,2,3) ;
> >
> > my $SQL = "select * from students where id in (@ids)";
>
> Instead use:
>
> my $SQL = 'SELECT * FROM students WHERE id NOT IN ('
> . join ',' , @ids
> . ')'
> ;
>
> Because a) you want NOT IN and b) The values inside the parens of the IN
> predicate must be comma-separated.