This is a little convoluted, so i apologize in advance.
I have multiple tables, one has the columns ID/Member/Type/UseDefault.
The other table has columns with descriptive information about a person, based on the ID.
Type will mostly be defualt. In which case, the information that corresponds with ID is perfectly fine. If UseDefault is false (which will only happen when type IS NOT defualt AND they do not want to use the default value), then the supplied ID is also perfectly suitable. However, if type is not default, but use default is entered as Yes, i need to display the information that is associated with the same member’s default ID.
ID / Member /Type /UseDefault
- 1 / joe / default /Y
- 2 / joe / additional /Y
- 3 / joe / third /N
in the table above when i join with the table that has all the descriptive information, for row 1 and 3, it is ok if i use their respective ID, but for 2, because type is not default and UseDefault is Y, i need to display the information for ID 1 (joe’s default ID). We will call the second table Info
basically i have
Select I.Car, I.Color, I.FavoriteFood from Info I join Example E where I.id = E.id