I have a table, hs_book that has column called GENRE_ID
I get the description of that genre from a table called GENRE
My subquery for column Genre :
SELECT *,
    Genre = (
        SELECT DESCRIPTION
        FROM GENRE
        WHERE GENRE_ID = (
            SELECT TOP 1 GENRE_ID 
            FROM BOOK_GENRES
            WHERE BOOK_ID = hs_book.BOOK_ID
            )
    )
FROM hs_book
When I execute this query, I get 525 books (which is correct).
At the request of a senior DBA, I am trying to convert it to a JOIN so I don't need the subquery, so I did this:
SELECT * FROM hs_book hsb
INNER JOIN BOOK_GENRES bg ON hsb.BOOK_ID = bg.BOOK_ID
When I run that, I get 541 results back, which is 16 more than the subquery.
After checking the data, I can see somehow, a few books have multiple GENRE_IDs.
Is there a way to modify my join so that I get only one genre back for each book?
 
     
    