我有三个不同的表:
所有人都有共同的领域。 project id
。
现在我希望细节显示在水晶报告上。当我根据特定项目选择时。
为此,我编写了一个存储过程,它绑定了所有三个表并提供了单个查询中所需的所有参数。
但我未能在三个不同部分获得所需信息。列名和数据分开如:
table1Column table1Column
table1Data table1Data
table2Column table2Column
table2data table2data
table3column table2column
table3data table3data
你可以帮我解决一下吗。我坚持这个。请帮助我将记录显示在三个不同的水晶报告中
谢谢
答案 0 :(得分:0)
假设所有三个表具有相同的列数。
SELECT
*
FROM
(SELECT * FROM employ_payment) a
UNION ALL
(SELECT * FROM misc_payment)
UNION ALL
(SELECT * FROM other_category_payment)
答案 1 :(得分:0)
SELECT table1.Column, table2.Column, table3.column
FROM table1
JOIN table2.Column ON project id
JOIN table3.Column ON project id
答案 2 :(得分:0)
不要创建存储过程,而是按照以下过程进行操作。
1. Take a report and insert 3 sub reports in that report, If you wish take 3 tables in main report and link those in links option using the `project ID`.
2. In sub report 1 take table1 and link to main report and place columns as per your requirement.
2. In sub report 2 take table 2 and link to main report and place columns as per your requirement.
3. In sub report 3 take table 3 and link to main report and place columns as per your requirement.
4. Now run the report you have the desired output.