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?
Sounds like you want a self-join:
Now I don’t know whether that will actually work in SQL… but logically it’s what you want.