我试图总结表上字段的值,但其中一个条件是日期,必须是从前一天,我试图使用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
答案 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