计算前一天的日期

时间:2015-07-20 13:18:09

标签: mysql date

我试图总结表上字段的值,但其中一个条件是日期,必须是从前一天,我试图使用sql curdate()但我到目前为止无法得到它工作:

string varsql = "SELECT  sum(merc1)/2 as total 
                 FROM  wgcdoccab 
                 where tipodoc ='FSS' 
                 and serie='1' 
                 and contribuinte='999999990' 
                 and SELECT DATE_ADD(CURDATE(), INTERVAL -1 DAY);"; //division query 

1 个答案:

答案 0 :(得分:0)

SELECT sum(merc1)/2 as total 
FROM wgcdoccab 
where tipodoc ='FSS' 
and serie='1' 
and contribuinte='999999990' 
and date_column = CURDATE() - INTERVAL 1 DAY