Combine results based on a value I need to join two tables where when the join condition is true, it
should return YES and returns NO if it doesnt. Let me try to give an
example:
I have BOOK_RENTALS which contains customer names and books:
JOHN SMITH, BOOKA
JOHN SMITH, BOOKB
JOHN SMITH, BOOKC
and I have a Book Master:
BOOKA
BOOKB
BOOKC
BOOKD
BOOKE
I would like to combine the results from these two tables such that I
get results as follows:
JOHN SMITH, BOOKA, YES
JOHN SMITH, BOOKB, YES
JOHN SMITH, BOOKC, YES
JOHN SMITH, BOOKD, NO
JOHN SMITH, BOOKE, NO
Is this possible in a single sql statement?
Any help is appreciated. |