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 6059741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:44:44+00:00 2026-05-23T08:44:44+00:00

Currently learning Linq to Entity. I been successful, but came stumped with the orderby

  • 0

Currently learning Linq to Entity. I been successful, but came stumped with the orderby clause and its use with multiple tables.

    var query = from k in contxt.pages.Include("keywords") 
where k.ID == vals.pageId select k;

My understanding with the code above is it creates an inner join where ID is equal to pageId.

So what I am having a difficult time visualizing is how I would perform an orderby on both tables?
I would like to sort on both tables.

I have tried:

var query = from k in contxt.pages.Include("keywords") where k.ID == vals.pageId orderby k.keywords.**?** select k;

The question mark is not supposed to be there. I am showing that the column that I would like to sort by isn’t there. Trying this k.Kegwords. doesn’t show the column.

I would write a SQL query as follows:

string query = "SELECT pages.page, pages.title, pages.descp, keywords.keyword
FROM pages INNER JOIN keywords ON pages.ID = keywords.pageID
ORDER BY keywords.sort, pages.page"; 

pages and keywords have a 1 to many relationship, which FK keywords.

Thank you,
deDogs

  • 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-23T08:44:45+00:00Added an answer on May 23, 2026 at 8:44 am

    Here you go.

              var result = (from x in pages
                          join y in keywords on x.ID equals y.pageID 
                          orderby y.sort, x.page
                          select new
                          {
                              x.Page,
                              x.title,
                              x.descp,
                              y.keyword
                          });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently learning C# and LINQ. I have lots of questions about them.
I'm currently learning a bit more about Linq-To-Entities - particularly at the moment about
Hi I am currently learning how to use service and notifications in android and
I'm currently working my way through the learning curve that is LINQ and I
So I've been working on learning LINQ, and I think I'm doing this correctly,
Im currently learning Objective C, and so far Ive been using Automatic Reference Counting
I'm currently learning about concurrency in C++ and came across using a vector of
As I'm currently learning to use WCF Services, I am constantly encountering tutorials on
Im currently learning multiple inheritance and ran into a problem creating a function that
I'm in the early stages of learning to use Entity Framework 4.1 using the

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.