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