Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select month/year from MYSQL query

Status
Not open for further replies.

skosterow

Technical User
Feb 23, 2002
135
US
Heya Gang -

I went to the site in my previous post, but i dont quite understand how this works. I need to extract a certain month and year. this is the code i am using:

my $dsn = "DBI:mysqlPP:tt_open:$DB::SERVER";
my $dbh = DBI->connect($dsn, $DB::USER, $DB::pASS);
my $sth = $dbh->prepare(qq{ SELECT number FROM open WHERE createby = '$STAFF::NAMES[$counter01]' and extract(month from createdate) = '$SELECT::MONTH' and extract(year from createdate) = 2003 });
$sth->execute();
while (($TT::NUMBER) = $sth->fetchrow_array())
{ $STAFF::OPEN = $STAFF::OPEN + 1; $TOTAL::OPEN = $TOTAL::OPEN + 1; }
$sth->finish();
$dbh->disconnect();

I'd prefer if you didnt give me code, but maybe point me somewhere, where there is a better description of how to do what i need..... that way i can get a better grasp on how MySQL does the select function.

Thanks in advanced.

- Scott
 
Sleipnir214,

im looking to add one to $STAFF::OPEN when say the month in a datestamp is = 4 and the year is = 2003.

Sorry about the way i posed the question, I did try to look it up on the net. no luck.

;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top