菜鸟 请教大神一个简单SQL语句问题 下班结帖!
[解决办法]
where Project 不为空嘛。。。。。。
[解决办法]
select distinct Period,[Year],Project from 表
where 条件 and Project 不为空
[解决办法]
group by period 分组试试
[解决办法]
select
Period,
[Year],
'' as AccountGroup,
Project,
'' as NaturalCode,
ACCNT_NAME, --这里是问题
'' as CostCenter,
sum(Amount)over(partition by Project) as Amount
from
vw_Journal_Inquiry
WHERE
(PERIOD BETWEEN '201303' AND '201306')
And (Costcenter IN ('0205','020501','020502'))
ORDER BY
[Year],
Period,
Project,
ACCNT_NAME
你每个ACCNT_NAME都不一样 你那样group by 肯定不行的