cancel
Showing results for 
Search instead for 
Did you mean: 

Can we use UNION ALL in Crystal Reports?

leon_laikan
Participant
0 Kudos

Dear All,

I sometimes use UNION ALL in SQL Queries to join the results of 2 similar queries together.

Like:

SELECT ... etc

FROM ...

WHERE ...

union all

SELECT ...

FROM ...

WHERE ...

I am writing a report in Crystal Report (for the 1st time),and incorporate SQL commands in

Crystal Reports.

I find that UNION ALL does not work.

Could anybody explain how I could do the equivalent of UNION ALL in Crystal Reports 2008 (ver 12.1.3.1028)?

Best Regards,

Leon Lai

---------------------------------

PS

If I am not following the SCN rules strictly, please be forgiving and answer my question here all the same.

I am having a very bad time finding my way in this new web site.

It will take me some time to get accustomed.

I do not even know where to award points to the experts, so if I don't award points, this is not intentional.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Leon

Union All will work in crystal reports.

we built report by using that

leon_laikan
Participant
0 Kudos

Hi Kamba,

Thanks for your reply. It gives me hope.

However, it does not work on my end.

The 2  queries work well separately in Crystal Reports.

But when I type 'UNION' or 'UNION ALL' between the 2 halves, it gives me this error message:

Failed to retrieve data from the database.

Incorrect syntax near the keyword 'UNION'

Pl note that I paste my SQL here (in Crystal Reports):

Database --> Database Expert ---> Edit Command

However, it works perfectly in SAP's Query Window.

What version of Crystal Reports do you use?

Thanks

Leon

leon_laikan
Participant
0 Kudos

Hi Kamba,

I did a simulation SQL containing only 2 lines of code.

UNION ALL works. So, you are perfectly right.

I don't know why my real query does not work. Will work on it.

Thanks a lot and Best Regards

Leon Lai

Former Member
0 Kudos

hi

If you are not able to rectify the error,can you post it here so that i can look for errors

Answers (0)