Can I do UNION ALL or UNION?

Posts   
 
    
Amith
User
Posts: 23
Joined: 21-Aug-2008
# Posted on: 28-Aug-2008 01:33:40   

Is there a way to add UNION ALL to the query?

My SQL statement is :

SELECT InvoiceId AS Id, InvoiceAmount AS TranAmount, InvoiceDate AS TranDate FROM Invoice UNION ALL SELECT PaymentId AS Id, PaymentAmount AS TranAmount, PayDate AS TranDate FROM Payment

How can I do this?

I am using Version 2.0

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Aug-2008 06:57:36   

Union Queries are not supported. You will have to perform 2 fetches Then you may merge the resultls into one bucket/container.

Otherwise if you want to perform one fetch only, then you can use database view in which you define the entire query (with the Union), and map it to a TypedView or an Entity.

David Elizondo | LLBLGen Support Team
Amith
User
Posts: 23
Joined: 21-Aug-2008
# Posted on: 28-Aug-2008 18:15:02   

Thanks. I am already using View.

But I was thinking of creating the query at the runtime so that I can include the where clause for each select in the union seperately. Since I have a Order By Clause on top of the Union, it make the performance very slow.

Anyway Thanks for the reply