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

IF (Exists) statement

Hi:

I have two tables: Table A has project ID and Submitted Item ID. Table B has project ID and Selected Item ID which is a subset of Submitted Item ID. I need to add a "Selected?" column to Table A which indicates if an item is selected from each project ID. I was thinking using "If (exists ([Submitted Item ID],[Selected Item ID],'Y','N')" statement, but it ignores the project ID. Any better solution?

Thanks

Yvonne

Table A:  

Project IDSubmitted Item IDSelected?
123AppleY
123BananaY
123OrangeN
123PearN
456BananaN
456OrangeN
456PearY
456WatermelonY

Table B:  

Project IDSelected Item ID
123Apple
123Banana
456Pear
456Watermelon

1 Solution

Accepted Solutions
swuehl
MVP
MVP

LOAD

     [Project ID] & [Selected Item ID] as TMPSelected

FROM TableB;

LOAD

     [Project ID],

     [Submitted Item ID],

     If(Exists(TMPSelected,  [Project ID] & [Submitted Item ID]), 'Y','N') as [Selected?]

FROM TableA;

View solution in original post

1 Reply
swuehl
MVP
MVP

LOAD

     [Project ID] & [Selected Item ID] as TMPSelected

FROM TableB;

LOAD

     [Project ID],

     [Submitted Item ID],

     If(Exists(TMPSelected,  [Project ID] & [Submitted Item ID]), 'Y','N') as [Selected?]

FROM TableA;