select ... where ... OR mdf_20 LIKE '_a4bbf326102e3064a8d9e06558c4b5e2020ee353HASH(0x826998)' ^^^^^^^^^^^^^^ #### select ... where ... OR mdf_20 LIKE '''_a4bbf326102e3064a8d9e06558c4b5e2020ee353HASH(0x826998)''' ^^ ^^^^^^^^^^^^^^^^ #### $sql = "SELECT action_id FROM transactions LEFT JOIN actions ON transactions.transaction_id = actions.transaction_id LEFT JOIN merchants ON merchant_id = idmerchants WHERE mdf_20 = ? AND action_type IN ('capture','sale') AND ABS(amount) = ABS(?) AND success = 1 AND processor_settlement_date IS NULL ORDER BY transaction_date;"; my $sth = $dbh->prepare($sql); $sth->bind_param(1, '1442a29888840b0b9505d34da6cd8897d153976d'); $sth->bind_param(2, 49.95); $sth->execute; my $aref = $sth->fetchrow_array if (defined $aref); print join(', ', @$aref),"\n"; $sth->bind_param(1, 'a4bbf326102e3064a8d9e06558c4b5e2020ee353'); $sth->bind_param(2, 4.95); $sth->execute; $aref = $sth->fetchrow_array; print join(', ', @$aref),"\n"; $sth->finish; my $like_cond = ''; $sql = "SELECT action_id,transaction_date FROM profitorius.actions WHERE transaction_id LIKE ? AND ABS(amount) = ABS(?) AND success = 1 AND action_type IN ('capture','sale') AND processor_settlement_date IS NULL ORDER BY transaction_date;"; $sth = $dbh->prepare($sql); $like_cond = '1442a29888840b0b9505d34da6cd8897d153976d%'; $sth->bind_param(1,$like_cond); $sth->bind_param(2, 49.95); $sth->execute; $aref = $sth->fetchrow_array; print join(', ', @$aref),"\n"; $like_cond = 'a4bbf326102e3064a8d9e06558c4b5e2020ee353%'; $sth->bind_param(1,$like_cond); $sth->bind_param(2, 4.95); $sth->execute; $aref = $sth->fetchrow_array; print join(', ', @$aref),"\n";