更新时间:2023-02-07 08:13:38
您的SQL查询看起来不错,但是我会用左边的语句删除该季度:
Your SQL query looks good, but I would remove the quarter with a left statement:
select state, gender, left(year,4) as [Year], count(ID) as N
from table1
group by state, gender, left([year],4)
然后你有一个经典的矩阵。使用报告向导创建新报告,选择矩阵,然后拖动字段:
Then you have a classic case for a Matrix. Create a new report with the Report Wizard, choose "Matrix", then drag the fields across:
行:状态
列:年份,性别
详细信息:N
这应该给你所需的矩阵。然后用
This should give you the required Matrix. Then replace the expression of the textbox with the Gender from
=Fields!gender.Value
到
=IIF(Fields!gender.Value="M", "Male", "Female")
祝你好运。