Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5999285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:31:51+00:00 2026-05-23T00:31:51+00:00

One Author can have many Book . Table Book have Author_Id on it. I

  • 0

One Author can have many Book. Table Book have Author_Id on it.

I Want a LINQ query that returns a IQueryable<Book> (So I can navigate with Book.Author.Name and stuff), but Only 1 Book per Author.

How do I do that with a LINQ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:31:52+00:00Added an answer on May 23, 2026 at 12:31 am

    Pretty sure this is it:

    var books = from a in authors
                from b in a.Books.Take(1)
                select b);
    

    Edit: Less hacky way to do this:

    var books = authors.Select(author => author.Books.First())
                       .Select(book => book);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a Publisher table that has many Books, and each Book can
I have two models e.g. Book and Author . An author can have many
I have blog with only one author. Author encapsulates many different fields that will
I have three entities. Author Newspaper Dissertation Newspaper and Dissertation both can have one
I have a model book with a one to many relation with authors. I
I have the following classes mapped as one to many: Reader and book when
I have a page that has many posts by different authors. I want the
[Book] isbn(PK),title,category_id,subcategory_id,price [Author] isbn(FK),author_id(PK),name [Category] category_id(PK),name [SubCategory] sub_category_id(PK),category_id(FK),name I have a database (not designed
I have the following set-up. BlogPosts BlogToCategory Category One blog post can have many
I'm trying to build a Hibernate Criteria query to find entities that have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.