Tag: Sum

  • Multiple Sum with different conditions in MySQL

    Today I was working on my last project that involves some statistics on data. I had a table like this: I needed the daily, monthly and yearly sum of the value field. The simplest approach was to have three different queries to retrieve the needed values: –day SELECT SUM(value) FROM table WHERE DATE(time)=CURDATE(); — month […]