SQL code
select Account,max(PYDate) as 最后消费日期,
sum(case when InOrOut=1 then [money] else 0 end) as 总共收入,
sum(case when InOrOut=0 then [money] else 0 end) as 支出金额
from tb
group by Account
[/Quote]
select Account,max(PYDate) as 最后消费日期,
sum(case when InOrOut=1 then [money] else 0 end) as 总共收入,
sum(case when InOrOut=0 then [money] else 0 end) as 支出金额
from tb
group by Account