对于列的每一行数据,如何在经典报表中显示其他列的多行?

时间:2020-06-20 11:46:06

标签: oracle oracle-apex

我有一个经典的报告,该报告显示了表中类的例程。看起来像这样: enter image description here

我希望第一列“上课日”具有从“星期一”到“星期五”的5个静态值。在那些日子的每一天中,都有多个班级,因此所有其他列在“上课日”列中的每一行都可以有多行。我该怎么办?

3 个答案:

答案 0 :(得分:2)

“经典报告”支持中断格式,该格式应可满足您的需求。

转到属性,在中断格式下,将中断列设置为第一列

答案 1 :(得分:1)

这里是一个选择:使用apply plugin: 'java-library' apply plugin: 'kotlin' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':autoadapter-annotations') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" } 函数,其分隔符为listagg标签。对于使用它的所有列,将“转义特殊字符”属性设置为“否”。

查询(以及一些示例数据):

<br>

输出看起来像这样:


,根据@Jeffrey Kemp的聪明主意,只需花费很少的精力即可,只需在第一列上设置中断(打开报表的属性,向下滚动“中断格式”属性集并设置中断)即可。到“第一列”。

如果我是你,我会使用此选项。

查询本身也更简单,不需要任何类型的聚合:

with routine (datum, class_name, room) as
  (select to_date('15.06.2020 07:00', 'dd.mm.yyyy hh24:mi'), 'Maths'    , 502 from dual union all
   select to_date('15.06.2020 10:00', 'dd.mm.yyyy hh24:mi'), 'Physics'  , 555 from dual union all
   select to_date('15.06.2020 12:00', 'dd.mm.yyyy hh24:mi'), 'Bio'      , 301 from dual union all
   select to_date('16.06.2020 09:00', 'dd.mm.yyyy hh24:mi'), 'Chemistry', 422 from dual union all   
   select to_date('16.06.2020 13:00', 'dd.mm.yyyy hh24:mi'), 'English'  , 415 from dual
  )
select to_char(datum, 'dd.mm., day') dan,
  listagg(to_char(datum, 'hh24:mi'), '<br>') within group (order by datum) sat,
  listagg(class_name               , '<br>') within group (order by datum) classes,
  listagg(room                     , '<br>') within group (order by datum) rooms
from routine
group by to_char(datum, 'dd.mm., day')      
order by 1;

答案 2 :(得分:0)

遍历查询,看来解决方案可以空白,除了每天class_day列中有一条记录。

Select case when rn = 1 then class_day end as class_day_final, 
       start_time, end_time, unit_title
  From
(Select t.*, 
       row_number() over (partition by class_day order by start_time) as rn
  From (<your_query>) t)
Order by class_day, rn
相关问题