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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:01:25+00:00 2026-05-23T16:01:25+00:00

I have such this table: position title ————————— 1 t1 2 t1 3 t2

  • 0

I have such this table:

position             title
---------------------------
1                     "t1"
2                     "t1"
3                     "t2"
4                     "t1"
5                     "t2"

I want to filter “t1” title but for positions that current position and next position have 1 difference. According this if I want first “t1” the result should be [1,2].

How I can write this query using linq 2 sql?

  • 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-23T16:01:26+00:00Added an answer on May 23, 2026 at 4:01 pm

    Sounds like you want a self-join:

    var query = from item1 in db.Items.Where(x => x.title == "t1")
                from item2 in db.Items.Where(x => x.title == "t1")
                where item1.position + 1 == item2.position
                select item1; // Adjust however you want, e.g. new { item1, item2 }
    

    Now I don’t know whether that will actually work in SQL… but logically it’s what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see many, many sites that have URLs for individual pages such as http://www.mysite.com/articles/this-is-article-1
Greetings! If I have XML such as this: <Root> <AlphaSection> . . . </AlphaSection>
I'm sure you've all seen them. Line of Business UIs that have logic such
I have IIS6 configured such that browsing to http://localhost:8082/Reports gets me the reporting services
I have a table containing multiple addresses, including their Lat/Long coordinates, and I want
Support we have an n * m table, and two players play this game.
My webpage currently looks like this: <asp:Table runat=server style=position: absolute; left: 0%; top: 82%;
I have this table in some code; <table> <tr><td align=left>One</td><td align=center>Two</td><td align=right>Three</td> <tr><td align=left>One</td><td
I have a table called Users it contain some fields such as Id, ParentId,
I have rows such as [ISSUE] This is a sample issue [WEBSITE] A bug

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.