有个Access 的sql语句不正确不知道问题出在哪里了,请路过的大侠们帮帮忙啊???????????????SELECT t.t_name, sum(ipd.ipd_money) AS totalMoney, t.t_type
FROM incomePayout AS ip, incomePayoutDetail AS ipd, types AS t
WHERE ip.ip_id=ipd.ip_id And ipd.t_id=t.t_id
GROUP BY t.t_name, t.t_type
HAVING DATEDIFF(month,ip.ip_date,now());
FROM incomePayout AS ip, incomePayoutDetail AS ipd, types AS t
WHERE ip.ip_id=ipd.ip_id And ipd.t_id=t.t_id
GROUP BY t.t_name, t.t_type
HAVING DATEDIFF(month,ip.ip_date,now());
也许只能这样吧...
SELECT t.t_name, sum(ipd.ipd_money) AS totalMoney, t.t_type
FROM incomePayout AS ip, incomePayoutDetail AS ipd, types AS t
WHERE ip.ip_id=ipd.ip_id And ipd.t_id=t.t_id
GROUP BY t.t_name, t.t_type HAVING DATEDIFF(month,ip.ip_date,now())='0';试试
差别在于interval是否要用引号;Access:
DateDiff('n',lastActiveTime,'" + DateTime.Now + "')>=5Sql:
server:DateDiff(n,lastActiveTime,'" + DateTime.Now + "')>=5interval 参数 (参数:为操作、事件、方法、属性、函数或过程提供信息的值。)包含以下设置:设置 说明
yyyy 年
q 季度
m 月
y 某年的某一天
d 天
w 工作日
ww 周
h 时
n 分
s 秒
参数
Year
yyyy Quarter
q Month
m Day of year
y Day
d Weekday
w Week
ww Hour
h Minute
n Second
s
'HAVING DATEDIFF(month,ip.ip_date,now())='0'',是怎么回事啊?
看看这个资料对你有没有帮助!
试图执行的查询中不包含作为合计函数一部分的特定表达式
'HAVING DATEDIFF(month,ip.ip_date,now())='0'',
应该怎么改啊,有诚意者写下邮箱,我把数据库发过去,
帮忙想想,应该怎么写???
SELECT t.t_name, sum(ipd.ipd_money) AS totalMoney, t.t_type
FROM incomePayout AS ip, incomePayoutDetail AS ipd, types AS t
WHERE ip.ip_id=ipd.ip_id And ipd.t_id=t.t_id And DATEDIFF('m',ip.ip_date,now())=0
GROUP BY t.t_name, t.t_type;谢谢各位顶贴!