423
Views
8
Comments
Solved
Union in SQL query
Question

Hi All,


I need to use a Union query as below,


SyntaxEditor Code Snippet

SELECT {UseCase}.[Titleusecase] from {UseCase} where {Application}.[Id]=Null
Union
Select {UseCase}.[Titleusecase]  from {UseCase} where {Application}.[Id]= @ApplicationId

But I am getting error in executing the query.

Can anyone help me with this, please?


Regards,

Ankita

2024-03-14 14-46-22
Nelson Inácio
Solution

Looks like you have communications problems with server. It's now a SQL related error.

You seem to have something wrong in SQL syntax. Instead of "where {Application}.[Id]=Null" should be "where {Application}.[Id] is Null"


2025-11-19 06-14-01
Miguel Verdasca
Champion

What kind of error you have?

UserImage.jpg
Ankita Kulkarni

Nuno Miguel Verdasca wrote:

What kind of error you have?

Hi Nuno,


Below is the error I am facing,


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

You filter on another entity than that you select from. Maybe {application} should be {usecase} on the where clause

2025-11-19 06-14-01
Miguel Verdasca
Champion

Daniël Kuhlmann wrote:

You filter on another entity than that you select from. Maybe {application} should be {usecase} on the where clause

Sorry Daniel, when I saw this error in the query, I was writing to him and when I published you had just published.


UserImage.jpg
Ankita Kulkarni

Daniël Kuhlmann wrote:

You filter on another entity than that you select from. Maybe {application} should be {usecase} on the where clause


Hi Daniel,


Even if I correct the entity name, I am facing the following error,

2025-11-19 06-14-01
Miguel Verdasca
Champion

But first of all, if you are filtering for an attribute from the Application table, you have to join the UseCase table with Application.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

No need for apologies, it's an active community and that is how it needs to be.

2024-03-14 14-46-22
Nelson Inácio
Solution

Looks like you have communications problems with server. It's now a SQL related error.

You seem to have something wrong in SQL syntax. Instead of "where {Application}.[Id]=Null" should be "where {Application}.[Id] is Null"


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.