I got a table like this, and use MYSQL 5.5
id
---
2
3
6
7
8
9
13
15
16
17
18
.
.
.
and I want to get the numbers 3 6 9 13 15, to be more accurate every number that fulfills
the condition:
id[i+1] - id[i] > 1 or id[i] - id[i-1] > 1
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Here you go (this assumes, that your id column really is sorted):
Ask, if you have any questions. Should be pretty self explaining, though.