按列排序未按预期工作

Sorting on column not working as expected

我有一份报告,其中包含姓名参数 - 名字姓氏

选择所有名称后,它应该在图表中显示值,table相应

在我的图表中,名称按排序顺序显示,但在我的 table 中,它们并不相同。

我在 sql 查询中使用了 'ORDERBY forename',并在 Tablix 属性中对名字进行了排序。

Query:

SELECT DISTINCT 
Code, Forename, Forename + ' ' + Surname AS Name, Age, Year, Area, Type, StartTime, EndTime
FROM Table
WHERE        (Age IN (@Age)) AND (Type IN (@Type)) AND (Year = @Year)
GROUP BY Code, Forename, Surname, Age, Year, Area, Type, StartTime, EndTime
ORDER BY Forename

O/P:

Code    Forename   Name   Age   Year    Area    Type    StartTime   EndTime
 SHEEA1 Alyson  Alyson Sheen    1416    2015    Eng+Maths   GCSE    1899-12-30 09:00    1899-12-30 10:30
 SHEEA1 Alyson  Alyson Sheen    1416    2015    Eng+Maths   GCSE    1899-12-30 13:15    1899-12-30 14:45
 SHEEA1 Alyson  Alyson Sheen    1416    2015    Eng+Maths   GCSE    1899-12-30 15:00    1899-12-30 16:30
 DIXOD1 Daniel  Daniel Dixon    1416    2015    Eng+Maths   GCSE    1899-12-30 10:45    1899-12-30 12:15
 DIXOD1 Daniel  Daniel Dixon    1416    2015    Eng+Maths   GCSE    1899-12-30 13:15    1899-12-30 14:45
 KAYEJ1 Jemma   Jemma Kaye  1416    2015    Eng+Maths   GCSE    1899-12-30 09:00    1899-12-30 10:30
 AMOOJ1 Josephine   Josephine Amoo  1416    2015    Eng+Maths   GCSE    1899-12-30 15:15    1899-12-30 16:45
 AMOOJ1 Josephine   Josephine Amoo  1416    2015    Eng+Maths   GCSE    1899-12-30 13:30    1899-12-30 15:00
 LEEK2  Katy    Katy Lee    1416    2015    Eng+Maths   GCSE    1899-12-30 09:00    1899-12-30 10:30
 LEEK2  Katy    Katy Lee    1416    2015    Eng+Maths   GCSE    1899-12-30 11:00    1899-12-30 12:30
 LEEK2  Katy    Katy Lee    1416    2015    Eng+Maths   GCSE    1899-12-30 13:30    1899-12-30 15:00
 NSUBL1 Lawrence    Lawrence Nsubuga    1416    2015 Eng+Maths GCSE 1899-12-30 13:15    1899-12-30 15:00
 NSUBL1 Lawrence    Lawrence Nsubuga    1416    2015    Eng+Maths   GCSE    1899-12-30 09:00    1899-12-30 10:30
 NSUBL1 Lawrence    Lawrence Nsubuga    1416    2015 Eng+Maths  GCSE    1899-12-30 15:00    1899-12-30 16:30
 GOODN1 Nicola  Nicola Goodman  1416    2015    Eng+Maths   GCSE    1899-12-30 09:00    1899-12-30 10:30

我该如何纠正?

Tablix 的行组有自己独立的排序属性集,这些属性优先于整个 Tablix 的排序属性。右键单击行组以打开其属性,然后选中排序选项。

如果您在 tablix 中根据人员的代码值创建了一个行组,则代码列将是该组的默认排序。通过更改组的属性,您仍然可以按代码分组,但按名字排序。