问题描述
我在sql中有2个表 table_a
和 table_b
这是输出:( 1对多关系)
I have 2 tables in sql table_a
and table_b
this is the output: (1 to many relationship)
table_a table_b
id_no (pk) name id_no (fk) id_tabl(pk) order_code order_item
1 a 1 1 11 aple
1 a 1 2 12 orange
1 a 1 3 13 ice
2 b 2 4 12 orange
2 b 2 5 13 ice
3 c 3 6 13 ice
3 c 3 7 12 orange
3 c 3 8 11 aple
我想只显示1个名字,所有 order_item
。
I want to display only 1 name with all his order_item
.
如何使用 iReport 在xml中?
How can I display it using
iReport
in the xml?
输出样本:
id_no name order_item
1 a aple
orange
ice
2 b orange
ice
3 c ice
orange
aple
仅使用2(
order_item
)我的发票的每个页面中的字段模式
其他显示将显示在发票页面2中。
Using only 2 (
order_item
) field pattern in every pages of my invoicethe other display will be displayed in invoice pages 2.
推荐答案
您应该使用
数据分组
。
你可以阅读关于数据分组。
You can read this article about data grouping.
- 您可以使用如下查询:
SELECT table_a.id_no, table_a.name, table_b.order_item FROM table_a, table_b WHERE table_a.id_no=table_b.id_no ORDER BY table_a.name
注意:可能需要按 <$ c添加排序$ c> table_a.id_no
列。
Note: may be you need to add sort by table_a.id_no
column.
- 你应该创建
iReport
的名称组
字段
注意:可能需要创建两个组 - id_no
和 name
字段。
Note: may be you need to create two groups - for id_no
and name
fields.
- 您可以使用
组
和详细信息
用于绘制数据行的波段。或者您可以将所有textField
元素放入Detail
区域。在这种情况下,您应该将false
值设置为isPrintRepeatedValues
textField
的属性(对于id_no
和名称
字段)。
- You can use the
Group
andDetails
bands for drawing the data row. Or you can put alltextField
elements to theDetail
band. In this case you should setfalse
value to theisPrintRepeatedValues
textField
's property (forid_no
andname
fields).
这篇关于如何在列中隐藏重复值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!