I am using the following code in Perl to mark distinct records in a table.
I am actually looking for duplicates but marking them this way leaves duplicates unmarked and it is those I process later.
The first select obtains a record set and then that record set is used to mark the appropriate records.
Is it possible to combine those quesries into a single one to speed the process up?
Keith
I am actually looking for duplicates but marking them this way leaves duplicates unmarked and it is those I process later.
The first select obtains a record set and then that record set is used to mark the appropriate records.
Is it possible to combine those quesries into a single one to speed the process up?
Code:
$sql="SELECT IMG, NUM FROM $IMTABLE GROUP BY IMG";
$sth=$dbh->prepare($sql);
$sth->execute();
$rv=$sth->rows;
while(@results=$sth->fetchrow_array()){
$sql1="UPDATE $IMTABLE SET DUPED=1 WHERE NUM=$results[1]";
$sth1=$dbh->prepare($sql1);
$sth1->execute();
$rv1=$sth1->rows;
}
Keith