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 mysql.pm in regardes to the %
>sign??
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.
>
>Jason
>
>Senior Network Engineer
>Jason Whitlow
>wk-714-384-3456
>cell-714-412-7299
>1221 E. Dyer Suite 150
>Santa Ana, CA. 92705