Count columns according to dates in SQL

前端 未结 3 872
说谎
说谎 2021-01-22 10:55

I need help with a SQL statement. The goal is to count the amount of alarms of each date. My table looks something like this:

|----DATE----|---COUNTER---|---ALAR         


        
相关标签:
3条回答
  • 2021-01-22 11:30

    Try this instead

    SELECT date, SUM(counter) FROM all_stats GROUP BY date;
    

    "GROUP BY date" puts all the individual dates on a separate line and does the sum separately per date.

    0 讨论(0)
  • 2021-01-22 11:35
    select date, sum(counter)
    from all_stats
    group by date
    
    0 讨论(0)
  • 2021-01-22 11:43
    SELECT date, SUM(counter)
    FROM all_stats
    GROUP BY date
    
    0 讨论(0)
提交回复
热议问题