There is a table of the form: Month Meaning January 6 January 67 January 12 February 34 February 11 March 22 March 3 March 14 March 8, etc. ...

the result of the query should be: Month Meaning January 85 February 45 March 29, etc.

those. you need to sum up the values ​​for each month, and the number of records with the same month is arbitrary.

    2 answers 2

    If I understand correctly:

    sql> select * from m_values +---------+---------+ | m_name | m_count | +---------+---------+ | январь | 6 | | январь | 67 | | январь | 12 | | февраль | 34 | | февраль | 11 | | март | 22 | | март | 3 | | март | 14 | | март | 8 | +---------+---------+ 

    Accordingly, the expression:

     sql> select m_name, sum(m_count) from m_values group by m_name +---------+--------------+ | m_name | sum(m_count) | +---------+--------------+ | январь | 85 | | февраль | 45 | | март | 47 | +---------+--------------+ 
       select month, count(*) from year group by month