in reply to MySQL pattern matching
It's not a Perl question, but a SQL syntax question. Still, it's something I can answer, so I don't want to let it drop =)
'%' is used in SQL SELECT ... LIKE statements, so you really want to be preparing this statement instead:
my $sth = $dbh->prepare("SELECT * FROM company_contact_info WHERE region LIKE '%San Diego%'");
There's other stylistic issues (like whether '%San Diego%' should be declared as a string and bound to the query), but that's extra. To get more info on how MySQL handles LIKE, check the online documentation page.
"All you need is ignorance and confidence; then success is sure." -- Mark Twain
|
|---|