List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 23 2002 5:39pm
Subject:Re: Perl to DBD::MySql
View as plain text  
At 9:09 -0800 1/23/02, Jason Whitlow wrote:
>I am trying to do a select statement but am having problems with the "%"  in
>my string.
>I am trying to
>$sth = $dbh->prepare("SELECT * FROM Years WHERE Date = '2002-%'");
>         $sth->execute();
>I just get nothing.  No Error messages, nothing.  All other sql statements
>work just fine. Is it something with the in regardes to the %

This has nothing to do with Perl or DBD:mysql.  You're trying to perform
a pattern match, but that requires the LIKE operator, not a =.  So write
the comparison like this:

	... WHERE Date LIKE '2002-%'

You might also try this to see if it's faster:

	... WHERE Date BETWEEN '2002-01-1' AND '2002-12-31'

>Thanks for any help.
>Senior Network Engineer
>Jason Whitlow
>1221 E. Dyer Suite 150
>Santa Ana, CA. 92705

Perl to DBD::MySqlJason Whitlow23 Jan
  • Re: Perl to DBD::MySqlColin Faber23 Jan
  • Re: Perl to DBD::MySqlDiana Soares23 Jan
  • Re: Perl to DBD::MySqlPaul DuBois23 Jan
RE: Perl to DBD::MySqlVasoczki Ferenc23 Jan
Re: Perl to DBD::MySqlFred van Engen23 Jan