日期:2014-05-18  浏览次数:20542 次

关于“MSSQL语句”转换成“Access语句”的问题
select   时间,sum(case   when   收支= "收入 "   then   钱字段   else   0   end)   as   "总收入 ",
                        sum(case   when   收支= "支出 "   then   钱字段   else   0   end)   as   "总支出 "   from   收支表  
where   时间   between   '2007-1-1 '   and   '2007-1-2 '   group   by   时间

------------------------------------------------
以上怎么转换成Access语句?

------解决方案--------------------
SELECT [时间], sum(IIf([收支]= "收入 ",[钱字段],0)) AS 总收入, sum(IIf([收支]= "支出 ",[钱字段],0)) AS 总支出
FROM 收支表
WHERE 时间 between #2007-1-1# and #2007-1-2#
GROUP BY [时间]