mysql - Getting sum of diffrent totals using different dates -


i have transaction table want sum total amount different dates, bellow code

select sum( total_amount ) total transaction execution_date between  "2015-08-1" ,  "2015-08-31" , execution_date between  "2015-09-1" ,  "2015-09-30" 

the code returns null. welcome.

you should write or instead and.since want display transactions in both range 2015-08-1" , "2015-08-31 , 2015-09-1" , "2015-09-30, contradiction, results null

select sum( total_amount ) total transaction  execution_date between "2015-08-1" , "2015-08-31"  or execution_date between "2015-09-1" , "2015-09-30" 

or

select sum( total_amount ) total transaction      execution_date between "2015-08-1" , "2015-09-30" 

hope helps


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -