php - How to display numbers that are skipped within a certain range mysql

I have query in mysql as follows
SELECT ont as next_ont_id FROM ont_activation WHERE olt_id =
'OLT-601167-1' AND lt = '1' AND pon = '2' AND activation_status =
'Activated';
Output: next_ont_id 65 67 68 69 70
how to get a value of 66 in that output??
Answer
Solution:
You can achieve this with PHP -
$val = explode(" ", "65 67 68 69 70");
$all = range($val[0], end($val)); // get all values between lowest & largest
print_r(array_diff($all, $val)); // check difference
Output -
Array
(
[1] => 66
)
Answer
Solution:
If you are sure that this is not a sampling error. Perhaps you should index the data again. in MySQL it is done like this
set @ROW = 0;
UPDATE `ont` SET `olt_id` = @ROW := @ROW+1 ORDER BY `olt_id` ASC;
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: an exception occurred in the driver: could not find driver
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.