As per my understanding, there is no chance to get output you wish to get, because there is no
start
and
end
tags and zero could be treated as a
start
or
end
tag.
I'd suggest to use
cursor[
^]. See:
MySQL Cursor[
^]. Cursors enables you to fetch data in
WHILE loop[
^].