Mysql data problems grounpby rows not good? Table, field
I want to get the sum of d_consutotal, but the condition is FROM_UNIXTIME (d_inputdate, '% Y-% M') = '2017-02' AND d_adaccount = '1 ', and according to the condition, only one of the same d_consutotal is obtained (the expected result is 3055.52 + 1111. 11 .........), now all the d_inputdate conversions are "2015-02.
How can I write this statement?
Reply to discussion (solution)
Sum function
Sum d_consutotal and write sum (d_consutotal)
Write sum (DISTINCT d_consutotal) for the same d_consutotal)
Since you have FROM_UNIXTIME (d_inputdate, '% Y-% M') = '2017-02' AND d_adaccount = '1' constraints, you will naturally only get the data results of March 2015.
Sum function
Sum d_consutotal and write sum (d_consutotal)
Write sum (DISTINCT d_consutotal) for the same d_consutotal)
Since you have FROM_UNIXTIME (d_inputdate, '% Y-% M') = '2017-02' AND d_adaccount = '1' constraints, you will naturally only get the data results of March 2015.
Brother zounin is really familiar with Bo Wen, and he has done it.