如何在Windows应用程序的水晶报表中显示两个表格数据 [英] how to display two table data in crystal report for windows application
问题描述
如何在Windows应用程序的水晶报表中显示两个表格数据
表格2在总和数据中当id 001和总计450相同的002和总计200
如何在水晶中显示报告?????
喜欢这种类型
表1中的数据显示下来ID和名称
id name
001 raja
002 vijay
003 suresh
表2数据显示下降id和值
< br $>
id value
001 100
001 200
001 150
002 200
003 150
003 200
和我的预计出局下来像
id名称价值
001 raja 450
002 vijay 200 >
003 suresh 350
请帮助
谢谢...... 。
您需要研究 Crystal Reports中的SQL查询 [ ^ ]
例如,给定创建 table table1
(
id int identity ( 1 , 1 ),
t1name varchar ( 10 )
)
insert into table1 values
(' raja'),
(' vijay'),
(' suresh')
创建 table table2
(
id int ,
value int
)
insert into table2 值
( 001 , 100 ),
( 001 , 200 ),
( 001 , 150 ),
( 002 , 200 ),
( 003 , 150 ),
( 003 , 200 )然后以下查询将获得您想要的结果
SELECT T1.id,T1.t1name,SUM(t2.value)
FROM table1 T1
INNER JOIN table2 T2 ON T1 .id = T2.id
GROUP BY T1.t1name,T1.id
how to display two table data in crystal report for windows application
table 2 in sum data when id 001 and total 450 same 002 and total 200
how to display in crystal Report?????
like this type
table 1 in data show down id and name
id name
001 raja
002 vijay
003 suresh
table 2 in data show down id and value
id value
001 100
001 200
001 150
002 200
003 150
003 200
and my Expected out down like
id name value
001 raja 450
002 vijay 200
003 suresh 350
please help
thank you.......
You need to study up on SQL queries in Crystal Reports[^]
For example, givencreate table table1 ( id int identity(1,1), t1name varchar(10) ) insert into table1 values ('raja'), ('vijay'), ('suresh') create table table2 ( id int, value int ) insert into table2 values (001, 100), (001, 200), (001, 150), (002, 200), (003, 150), (003, 200)then the following query will get the results you want
SELECT T1.id, T1.t1name, SUM(t2.value) FROM table1 T1 INNER JOIN table2 T2 ON T1.id = T2.id GROUP BY T1.t1name, T1.id
这篇关于如何在Windows应用程序的水晶报表中显示两个表格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!