【问题标题】:asp.net rdlc reportasp.net rdlc 报告
【发布时间】:2020-01-13 05:09:02
【问题描述】:

RDLC 行问题, 来自数据库的动态列, 行数不够。

RDLC报告如下。

col1   col2   col3
AA
BB
        CC 
               DD
EE

我想这样安排。

col1   col2   col3
AA      CC     DD
BB
EE

我需要在sql中更改一些代码吗?
感谢您的帮助。

选择 TBL1.FullName AS StaffName, EducationInfo.Description AS 描述

来自 TBL1
INNER JOIN Qualification ON Qualification.StaffID = TBL1.StaffID
INNER JOIN QualificationItem ON QualificationItem.QualificationID = Qualification.QualificationID INNER JOIN EducationInfo ON EducationInfo.EducationID = QualificationItem.EducationID

WHERE QualificationItem.Active=1 AND St​​aff.Active = 1

【问题讨论】:

  • 用您正在使用的数据库标记您的问题。查询与问题有什么关系?数据似乎指向单个表或结果集。

标签: sql asp.net rdlc


【解决方案1】:

您可以取消旋转和重新旋转取消聚合:

select max(case when which = 1 then col end) as col1,
       max(case when which = 2 then col end) as col2,
       max(case when which = 3 then col end) as col3       
from (select col, which, row_number() over (partition by which order by ordcol) as seqnum
      from ((select col1 as col, 1 as which, ? as ordcol from rldc) union all
            (select col2 as col, 2 as which, ? as ordcol from rldc) union all
            (select col3 as col, 3 as which, ? as ordcol from rldc) 
           ) r
      where col is not null
     )
group by seqnum;

SQL 表代表无序 集合。您似乎假设您的价值观中保留了顺序。这不是一个合理的假设。 ? 用于指定排序的列。

【讨论】:

    猜你喜欢
    • 2011-02-20
    • 1970-01-01
    • 2012-01-24
    • 1970-01-01
    • 2015-08-04
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多