1. Original data column: mobile phone number, date, quantity 2. decode query result column: mobile phone number, total number in December October 1, and total number in December October 2... Total number of December 2012 select distinct recommender, sum (decode (to_char (handel_date, 'yyyy-mm-dd'), '2017-10-01 ', 1, 0) num, sum (decode (to_char (handel_date, 'yyyy-mm-dd'), '2017-10-02 ', 1, 0) num, sum (decode (to_char (handel_date, 'yyyy-mm-dd'), '2017-10-03', 1, 0) num, sum (decode (to_char (handel_date, 'yyyy-mm-dd '), '2017-10-04', 1, 0) num, sum (decode (to_char (handel_date, 'yyyy-mm-dd'), '2017-10-05', 1, 0) num, sum (decode (to_char (handel_date, 'yyyy-mm-dd'), '2017-10-06 ', 1, 0) num, sum (decode (to_char (handel_date, 'yyyy-mm-dd'), '2017-10-07', 1, 0) num from rurality_recommenddg t www.2cto.com where t. status = '3' and t. handel_date> to_date ('2017-10-01 ', 'yyyy-mm-dd') and t. handel_date <to_date ('1970-10-08 ', 'yyyy-mm-dd') group by recommender;