I try to select posts.
A post have a field x with [1,9]
We need all posts with x = [1,9] around this post.
But it seems i need two queries:
example could be
posts with x =;
*=current
1
2
1
2
3*
1
2
3
4
5
6
7
8
9
Before 3 must be 2 and 1, easy < sorted by DESC date limit 2
After 3 could be max 4,5,6,7,8,9 '=> limit 6, but needs walk-through to check if we increase by one or not.
Result from above must be:
1,2,3
What I want to find out, is to have one query in both directions, and for that, but I have no idea.
I can have two queries, while I know that before x
must be 1 until x-1 and after x
can be x+1 until 9;
plus check to have a row and no break (example: after 3 comes 1, is a break of the row)
Why I do this?
I try to work with posts that are grouped somehow, and I don't want to use more than one new table_field and no new table.
Two queries should do it. I have no idea how to do it with one query because how to set the limit to choose: take ten left and ten right!