Combine results based on a value
From: <aravind.kanda_at_gmail.com>
Date: Fri, 22 Feb 2008 13:38:24 -0800 (PST)
Message-ID: <1e5d53ee-0bf4-44c0-897f-27745ff506c2@f47g2000hsd.googlegroups.com>
Date: Fri, 22 Feb 2008 13:38:24 -0800 (PST)
Message-ID: <1e5d53ee-0bf4-44c0-897f-27745ff506c2@f47g2000hsd.googlegroups.com>
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. Received on Fri Feb 22 2008 - 15:38:24 CST