$sth = $dbh->prepare("select a from b where (c=? and d=?) or (c=? and f=?)"); $sth->execute( $cval, $dval, $cval, $fval );