显示多对一关系的组

发布于 2024-10-21 04:28:01 字数 1465 浏览 0 评论 0原文

我需要在 iReport 中创建一个 JasperReport,列出员工信息,包括学位和认证信息。 我的查询返回我需要的所有数据(我认为),但我不知道如何在 IReport 中执行组和/或详细信息,以便它按我需要的方式显示。

这是我的查询:

select e.eid, e.first_name, e.last_name, 
       d.degree_date, d.degree_name, 
       c.cert_date, c.cert_name
from employees e, degrees d, certifications c
where e.eid = d.eid
and e.eid = c.eid

这是结果:

1234, John, Smith, 01/01/2010, MCSE, 4/4/2001, B.S. Information Systems
1234, John, Smith, 01/01/2010, MCSE, 5/5/2004, M.S. Comupter Science
1234, John, Smith, 03/01/2010, CISSP, 4/4/2001, B.S. Information Systems 
1234, John, Smith, 03/01/2010, CISSP, 5/5/2004, M.S. Comupter Science
1235, John, Rolph, 01/01/2010, Pottery Instruction, 6/6/2001, B.A. Fine Arts 
1235, John, Rolph, 01/01/2010, Pottery Instruction, 7/7/2004, M.S. Education
1235, John, Rolph, 03/01/2010, Adv Pottery, 6/6/2001, B.A. Fine Arts
1235, John, Rolph, 03/01/2010, Adv Pottery, 7/7/2004, M.S. Education

我需要像这样显示报告:

Employee ID Employee Name
1234    John Smith
        Certifications:
        01/01/2010 MCSE
        03/01/2010 CISSP
        Degrees:
        4/4/2001 B.S. Information Systems
        5/5/2004 M.S. Comupter Science

1235    John Rolph
        Certifications:
        01/01/2010 Pottery Instruction
        03/01/2010 Adv Pottery
        Degrees:
        6/6/2001 B.S. B.A. Fine Arts
        7/7/2004 M.S. Education     

如果您有任何建议,请告诉我。

I need to create a JasperReport in iReport that lists employees info including degree and certification information.
My query returns all the data I need (i think) but I can't figure out how to do the groups and/or details in IReport so that it displays like I need.

Here is my query:

select e.eid, e.first_name, e.last_name, 
       d.degree_date, d.degree_name, 
       c.cert_date, c.cert_name
from employees e, degrees d, certifications c
where e.eid = d.eid
and e.eid = c.eid

Here are results:

1234, John, Smith, 01/01/2010, MCSE, 4/4/2001, B.S. Information Systems
1234, John, Smith, 01/01/2010, MCSE, 5/5/2004, M.S. Comupter Science
1234, John, Smith, 03/01/2010, CISSP, 4/4/2001, B.S. Information Systems 
1234, John, Smith, 03/01/2010, CISSP, 5/5/2004, M.S. Comupter Science
1235, John, Rolph, 01/01/2010, Pottery Instruction, 6/6/2001, B.A. Fine Arts 
1235, John, Rolph, 01/01/2010, Pottery Instruction, 7/7/2004, M.S. Education
1235, John, Rolph, 03/01/2010, Adv Pottery, 6/6/2001, B.A. Fine Arts
1235, John, Rolph, 03/01/2010, Adv Pottery, 7/7/2004, M.S. Education

I need the report to display like this:

Employee ID Employee Name
1234    John Smith
        Certifications:
        01/01/2010 MCSE
        03/01/2010 CISSP
        Degrees:
        4/4/2001 B.S. Information Systems
        5/5/2004 M.S. Comupter Science

1235    John Rolph
        Certifications:
        01/01/2010 Pottery Instruction
        03/01/2010 Adv Pottery
        Degrees:
        6/6/2001 B.S. B.A. Fine Arts
        7/7/2004 M.S. Education     

Let me know if you have any suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

━╋う一瞬間旳綻放 2024-10-28 04:28:01

正如 DaDaDom 建议的那样,使用一份报告和两个子报告:

报告 1 - 人员 子

1234    John Smith

报告 1.1 - 认证

        01/01/2010 MCSE
        03/01/2010 CISSP

子报告 1.2 - 学位

        4/4/2001 B.S. Information Systems
        5/5/2004 M.S. Comupter Science

综合结果

然后:

  1. 在主报告中添加一个组带。
  2. 按员工 ID 分组
  3. 将“证书”子报表包含在“组”区域中。
  4. 将“度数”子报表包含在“组”区域中。
  5. 将员工 ID 从主报表传递到子报表。
  6. 让每个子报表根据收到的员工 ID 参数查询必要的信息。

As DaDaDom suggested, use one report and two subreports:

Report 1 - Person

1234    John Smith

Subreport 1.1 - Certifications

        01/01/2010 MCSE
        03/01/2010 CISSP

Subreport 1.2 - Degrees

        4/4/2001 B.S. Information Systems
        5/5/2004 M.S. Comupter Science

Combined Results

Then:

  1. Add a Group band to the main report.
  2. Group By the employee ID.
  3. Include the Certificates subreport in the Group band.
  4. Include the Degrees subreport in the Group band.
  5. Pass the employee ID from the main report to the subreports.
  6. Have each subreport query the requisite information based on the employee ID parameter that they receive.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文