Hi:

Isn't table2 needed? Like:

SELECT table1.failed_parts
FROM table1, table2
WHERE table1.failed_parts = table2.valid_parts

Joins work fine to me accessing an Oracle DB vía DBI.

    my $sql = qq{
                  SELECT cdg, nmb, dsc, info, figProd1, figProd2
                  FROM   Secc S, Dvde D
                  WHERE  D.tnda = ?
                  AND    S.cdg = D.secc
                  AND    ((S.oscur IS NULL) OR (S.oscur NOT LIKE '%erdad%'))
                };
    $Secc::sth = $dbh->prepare( $sql );
    $Secc::sth->bind_param( 1, $tnda,  SQL_INTEGER );
    $Secc::sth->execute();
    $Secc::sth->bind_columns( undef,
                              \$self->{cdg},
                              \$self->{nmb},
                              \$self->{dsc},
                              \$self->{info},
                              \$self->{figProd1},
                              \$self->{figProd2}
                            );

Greetings

        Quique

[EMAIL PROTECTED] wrote:

> Hi,
> I am using perl DBI to access an sql server database.
> One table has component part numbers that have failed, keyed in by
> operators. I need to read in and count these which is no problem but I also
> need to compare them with an approved parts table to make sure that they are
> valid part numbers. Currently I am doing this by reading the failed parts
> into a hash and then using the hash keys as placeholders to query the parts
> valid table.
> Is it possible with DBI to do something like
> SELECT table1.failed_parts FROM table1 WHERE table1.failed_parts =
> table2.valid_parts
>
> thanks Willie
>
> Willie McSweeney
> Memory Component Engineer
> EMC,
> Ovens,
> Co.Cork, Ireland.
> Tel +00353-21-4281412
> Fax +00353-21-4281898
> Email <[EMAIL PROTECTED] >

Reply via email to