在Crystal Reports 11中单独在多个表上报告 [英] Reporting on multiple tables independently in Crystal Reports 11

查看:136
本文介绍了在Crystal Reports 11中单独在多个表上报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Crystal Reports Developer Studio创建一个报表,报告两个不同的表,让它们成为ATable和BTable。对于我最简单的任务,我想使用总运行字段报告每个表的计数。我创建了一个ATable(称为ATableTRF),当我发布在我的报告这是发生了什么:

I am using Crystal Reports Developer Studio to create a report that reports on two different tables, let them be "ATable" and "BTable". For my simplest task, I would like to report the count of each table by using Total Running Fields. I created one for ATable (Called ATableTRF) and when I post it on my report this is what happens:

1)SQL查询(显示SQL查询)显示: / p>

1) The SQL Query (Show SQL Query) shows:

SELECT "ATABLE"."ATABLE_KEY"
FROM   "DB"."ATABLE" "ATABLE"

2)读取的总记录是ATable中的记录数。

2) The total records read is the number of records in ATable.

3)我得到的数字是正确的(ATable中的总记录)。

3) The number I get is correct (total records in ATable).

对于BTableTRF也是如此,如果我删除ATableTRF我get:

Same goes for BTableTRF, if I remove ATableTRF I get:

1)SQL查询(显示SQL查询)显示:

1) The SQL Query (Show SQL Query) shows:

SELECT "BTABLE"."BTABLE_KEY"
FROM   "DB"."BTABLE" "BTABLE"

2 )读取的总记录是BTable中的记录数。

2) The total records read is the number of records in BTable.

3)我获得的数字是正确的(BTable中的总记录)。

3) The number I get is correct (total records in BTable).

问题开始,当我只是把两个字段的报告。然后发生的是,我得到两个查询一个接一个(因为表没有链接在水晶报表中):

The problems starts when I just put both fields on the reports. What happens then is that I get the two queries one after another (since the tables are not linked in crystal reports):

SELECT "ATABLE"."ATABLE_KEY"
FROM   "DB"."ATABLE" "ATABLE"

SELECT "BTABLE"."BTABLE_KEY"
FROM   "DB"."BTABLE" "BTABLE"

读取的记录数远远大于每个表 - t停止。我会验证它的计数(ATable)xcount(BTable),但这将超过我的计算机的限制(可能 - 一个大约300k行,其他大约900k行)。

And the number of record read is far larger than each of the tables - it doesn't stop. I would verify it's count(ATable)xcount(BTable) but that would exceed my computer's limitation (probably - one is around 300k rows the other around 900k rows).

只是想报告两个表的计数。

I would just like to report the count of the two tables. No interaction is needed - but crystal somehow enforces an interaction.

任何人都可以帮忙吗?

谢谢!

推荐答案

除非有一些连接描述两个表的关系,否则结果将是一个笛卡尔乘积。尝试使用两个子查询,通过SQL命令或单个SQL表达式,获取行计数。例如:

Unless there is some join describing the two tables' relationship, then the result will be a Cartesian product. Try just using two subqueries, either via a SQL Command or as individual SQL expressions, to get the row counts. Ex:

从ATABLE选择计数(distinct ATABLE_KEY)

如果除了行计数之外,对这些表中的任何其他内容都不感兴趣,那么没有理由将所有这些行都转换为Crystal - 更好地处理RDBMS上的繁重工作。

If you're not interested in anything else in these tables aside from the row counts, then there's no reason to bring all those rows into Crystal - better to do the heavy lifting on the RDBMS.

这篇关于在Crystal Reports 11中单独在多个表上报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆