Date problem in MYSQL Query

Posted by davykiash on Stack Overflow See other posts from Stack Overflow or by davykiash
Published on 2010-03-31T09:10:34Z Indexed on 2010/03/31 9:13 UTC
Read the original article Hit count: 481

Filed under:

Am looking for a query to sum values in a particular time duration say an year or a particular month in an year using MYSQL syntax.Note that my transaction_date column stores daily amount transacted.

Am example of a query that returns total sales in an year query would look something like this

SELECT SUM(transaction_amount) WHERE transaction_date = (YEAR)

Am example of a query that returns total sales in an particular month and year would look something like this

SELECT SUM(transaction_amount) WHERE transaction_date = (YEAR)(MONTH)

How achievable is this?

© Stack Overflow or respective owner

Related posts about mysql-query