Request:
SELECT * FROM table WHERE s=1 ORDER BY id Received a number of id: 2,5,6,7,9,11,12,15,16,17,18,20
Which MySQL operator can be pulled from the above series:2,5,6,7,12,15,16,17 ?
The selection condition is to leave the numbers that make up the pair - the number itself and it’s plus 10.
That is, we take 2, we add 10 (it turns out 12), in this row there is the number 12 - bingo! - both are left, then we take 5 and look for 5 + 10 = 15 - there are both two, too - we leave both and so on, and now we come to 9 - we add 10, we get 19, there is no such number, we delete nine.
So it did not work out:
SELECT * FROM (SELECT * FROM table WHERE s=1 ORDER BY id) aa WHERE ((aa.id MOD 10)=0)