perl code

#connect to the database
my $dbh = DBI->connect('dbi:mysql:rvsi','','', {RaiseError=>1, PrintError=>1});

# Extract the data from database
my $d = $dbh->selectall_arrayref("SELECT date, qin, qout,yield, reject, lot FROM yield WHERE date BETWEEN '$datef' AND '$datet'");
    print ("Daily Yield Report Summary for '$dev' between '$datef' to '$datet'\n\n");
    print ("Date\t\t", "Qin\t", "Qout\t", "Yield\t", "Reject\t", "Lot\n");

# Print out all the array catch  
foreach my $r(@$d) {
    print join("\t", @$r), $/;

the above perl code allows me to crunch data from the db according to the date given by the
user. jus wan to know can the data be crunch and display each individual day in a month?
eg day 1 all the way to day 30 or 31 another eg is
my $d = $dbh->selectall_arrayref("SELECT date_format(date, '%b'), sum(qin), sum(qout), ((sum(qout)/sum(qin))*100), sum(reject) FROM yieldall WHERE year(date) = '$year' AND job = '$dev' GROUP BY date_format(date, '%b') ORDER BY date")

if possible can anyone provide samples.

thank u.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I'm not sure exactly what you want. Can you please give more concrete info about what you would like to do?

That's probably no perl question but about sql. We have to know the used database to tell you the right sql-statement.

TPolyAuthor Commented:
i'm using mysql as my db
I'd love to help you out, but I still am unsure of what you want to do -- can you please be more specific about exactly what you are trying to achieve?
It also depends on what version of MySQL you are using (some of the very useful date functions have only recently become available), and how you have stored your date information...I would check out this page if I were you:

What you probably want is something like this:

SELECT * FROM table WHERE date1 <= date_column AND date2 >= date_column;

This should select all rows from your database where the date you have stored in date_column is between date1 and date2.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.