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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:03:53+00:00 2026-05-23T07:03:53+00:00

I have a situation where I need to do a self join on a

  • 0

I have a situation where I need to do a self join on a table in LINQ. The table consists of fields ItemsID, Title, SeriesTitle, and many other. An item can be either a series or members and I can tell that by looking into ItemId which has “S” or “M” letters on it. I need to retrieve all records that are member of a series with ItemId “S117”. I can do this in simple SQL by the code below,

select  i.Series_Title, i.Item_ID, i2.Item_ID as Member_ID, 
        i2.Title as Member_Title, i2.Series_Title as Member_Series_Title 
        from Items i join Items i2 on i.Series_Title = i2.Series_Title
        where i.Item_ID = "S117"

Now, I translated this query in LINQ which goes as

items = _dataContext.Items.AsQueryable();
items = from series in items 
        join members in items on series.Series_Title.ToLower() 
        equals members.Series_Title.ToLower()
        where series.Item_ID.ToLower().Equals(itemId)
        select series;

The last line of this query select series will only retrieve series but not members and I need members also.
I am using MVC3 Razor view where I have to display almost all fields so I am not using select new {....}
Even when I tried to use select new {series, members}, I got this exception –

Cannot implicitly convert type
‘System.Linq.IQueryable’
to ‘System.LinQ.IQueryable<My.App.models.Items>’
An explicit conversion exist.

Any suggestions would be highly appreciated.

  • 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-23T07:03:54+00:00Added an answer on May 23, 2026 at 7:03 am

    Try this:

    var items1 = _dataContext.Items.AsQueryable();
    var items2 = from series in items1 
            join members in items1 on series.Series_Title
            equals members.Series_Title
            where series.Item_ID== 'S117'
            select series;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have situation where I need to change the order of the columns/adding new
I have a situation where I need to be able to load assemblies in
I have a situation where I need to work with a datagrid and adding
I have a situation where i need to debug a Windows CE application in
I have a situation where I need to add an arbitrary unique id to
I have a situation where I need to do something like select 2, id
I have a situation where i need to enforce a unique constraint on a
I have a situation where I need to update a control referenced in a
I have a situation where I need to notify some users when something in
I have a situation where I need to find the value with the key

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.