为何日期条件不起作用???
最近7天
SELECT a.Id, a.outname, SUM(IIf(ISNULL(b.outMoney),0,b.outMoney)) AS Total FROM tatty_outtype AS a LEFT JOIN tatty_outlist AS b ON (b.outtype = a.id and a.tattyid=1 and datediff('d',outtime,now())<7) GROUP BY a.id, a.outname ORDER BY a.id
5-1到5-10之间
SELECT a.Id, a.outname, SUM(IIf(ISNULL(b.outMoney),0,b.outMoney)) AS Total FROM tatty_outtype AS a LEFT JOIN tatty_outlist AS b ON (b.outtype = a.id and a.tattyid=1 and outtime between #2018-05-01# and #2018-05-10#) GROUP BY a.id, a.outname ORDER BY a.id
这两条语句,在Access数据库里面查询,是起作用的。
但是放到程序里面,就没有用,查询出来的是所有的数据,这是为啥,不解。。