I am creating an ASP.NET C # library system. Take a screenshot (MSSQL) of DB-design:

To display books, I use the Rent table. But there is my problem :
- I left the “Rent” table in the Books table (because books that have not yet been rented once should also be shown) (see book with identifier 3)
- When I just left to join, I see that my books turn off several times in my books - a review ...
- SO : I need a LINQ query that connects books to rents, but if books are already rented several times, it should join the last value in the table of this book_id
- : ...
- ( : - , value = 0, , 1)

:
var query = (from b in db.Books
join a in db.Authors on b.author_id equals a.author_id
join c in db.Categories on b.category_id equals c.category_id
join r in db.Rentals on b.book_id equals r.book_id into lf
from r in lf.DefaultIfEmpty()
select new BookDetails(
b.book_id,
b.title,
b.ISBN,
b.description,
b.author_id,
a.firstName,
a.lastName,
b.category_id,
r.returned == null ? 1 : r.returned)
).ToList();
, , ...
- "MAX"? ( linq?)