mysql - SUM(quantity) 00:00 - 23.59 Yesterday -


based on how make interval entire day 00:00 - 23.59 ( yesterday )

select sum(quantity)     downloads   date>=current_date()   , date<current_date() + interval '1' day  

try it-

select sum(quantity)     downloads   date>=concat(subdate(curdate(), interval 1 day),' 00:00:00')   , date<= concat(subdate(curdate(), interval 1 day),' 23:59:59') 

or can use-

select sum(quantity)     downloads   date>=subdate(curdate(), interval 1 day)   , date< curdate(); 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -