سؤال

I am working in Crystal Reports 2011 and I am trying to merge two tables from two different data sources into one command to use in a report.

I am having a hard time finding any solid examples online of how to accomplish this inside of a command. I would expect to use a UNION and it look something like:

SELECT *
FROM DSN1.Employee
UNION
SELECT *
FROM DSN2.Employee

The two tables are the exact same, just in different databases that I cannot alter or add to.

Any guidance would be a tremendous help. Thank you in advance.

لا يوجد حل صحيح

نصائح أخرى

Dont know exactly what you mean by having a hard time anyway try something like this ....

Explicitly mention the column names in both selects and use UNION ALL, use fully qualified names of your tables something like this....

SELECT Column1, Column2, Column3, ..... <Other Column Names>
FROM [Database_Name1].[Schema1].[Table_Name1]
UNION ALL
SELECT Column1, Column2, Column3, ..... <Other Column Names>
FROM [Database_Name2].[Schema1].[Table_Name2]

using this syntax eliminates most of the possible errors.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top