
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ID | Submitted Item ID | Selected? |
123 | Apple | Y |
123 | Banana | Y |
123 | Orange | N |
123 | Pear | N |
456 | Banana | N |
456 | Orange | N |
456 | Pear | Y |
456 | Watermelon | Y |
Table B:
Project ID | Selected Item ID |
123 | Apple |
123 | Banana |
456 | Pear |
456 | Watermelon |
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
