$month=`date --date='1 month ago' +%B`; my $sth = $dbh->prepare("SELECT * from $table where monthname(Date)='$month'" );