I've got a stored procedure with a select statement, like this:
SELECT author_ID,
author_name,
author_bio
FROM Authors
WHERE author_ID in (SELECT author_ID from Books)
This limits results to authors who have book records. This is the Books table:
Books:
book_ID INT,
author_ID INT,
book_title NVARCHAR,
featured_book BIT
What I want to do is conditionally select the ID of the featured book by each author as part of the select statement above, and if none of the books for a given author are featured, select the ID of the first (top 1) book by the author from the books table. How do I approach this?