The WHERE clause depends on what format you have the date stored in the table. If it's in a standard format that mysql accepts like yyyy-mm-dd then you can use the mysql date functions. The mysql function you need to use is called MONTHNAME(). I haven't written sql queries in a long time so I'm not sure how to do it correctly. Try something like this
select amount from Table where MONTHNAME(date_column) = 'August';
You might be able to modify it to return the sum in one statement.
Alvin wrote:
Hi,
I have some problem executing a sql query in MySQL. I have a table consisting of 2 columns, date and amount. I am trying to retrieve a summary of total amount for a particular month.
Here's the psuedo code:
SELECT SUM(amount)
from Table
Where month = july/2000
What's the correct syntax for MySQL ? Thanks a lot in advance.