Getting revenue for specific month and year
I hav a revenue table where I store several prices, and the date of each transaction. Now I need th e revenue for a specific month/year. I have for now, this code, but it gives no result, although there are entries for that specific period.
Can someone guide me to a solution for this?
SELECT SUM(treatment_price + arrangement_price + product_price) as revenue FROM (`revenue`) WHERE `user_id` = '9' AND month(date) = 02 and year(date) = 2010