Tables table, Fields
I want to get the sum of d_consutotal, but the condition is to From_unixtime (d_inputdate, '%y-%m ') = ' 2015-02 ' and d_adaccount= ' 1 ', and conditionally, the same d_ Consutotal only take one (the result is 3055.52+1111.11 ...), now all of these d_inputdate are "2015-02" after the conversion.
How do I write this statement?
Reply to discussion (solution)
Sum function for sum
Sum of d_consutotal, sum of writing (D_consutotal)
The same d_consutotal only takes one, then writes sum (DISTINCT d_consutotal)
Since you have From_unixtime (d_inputdate, '%y-%m ') = ' 2015-02 ' and d_adaccount= ' 1 ' constraints, you will naturally only get data results for February 2015
Sum function for sum
Sum of d_consutotal, sum of writing (D_consutotal)
The same d_consutotal only takes one, then writes sum (DISTINCT d_consutotal)
Since you have From_unixtime (d_inputdate, '%y-%m ') = ' 2015-02 ' and d_adaccount= ' 1 ' constraints, you will naturally only get data results for February 2015
Zu Ning brother really knowledgeable ah, has been done.