Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Flag if Value exists in another table

Hi,

I have two tables in my sql server, Table A and Table B. I am creating a qvw/qvd file and pulling Table A in it. I want to create a Flag field to identify which of the values of a field called ID were existing in Table B. I do not have to necessarily pull in data from Table B.

I just need a Flag to identify the ones that existed and the ones that didn't exist.

Could anyone please suggest how to do it.

Capture.JPG

Thank You.

1 Solution

Accepted Solutions
Sergey_Shuklin
Specialist
Specialist

Hello!

You can use join for achieving this

join_ids.png

View solution in original post

4 Replies
marcus_sommer

You could try something like this:

B: load distinct ID from B;

A: load *, -exists(ID) as Flag from A;

drop tables B;

- Marcus

Sergey_Shuklin
Specialist
Specialist

Hello!

You can use join for achieving this

join_ids.png

Anonymous
Not applicable
Author

Worked perfectly fine for me.

Thank You.

Anonymous
Not applicable
Author

Hi,

Thank you for your response.

I had tried a similar solution but couldn't get the right numbers.