• I wouldn't actually use a join.

    Instead just use a condition to get values after the last non zero value. In order to do that, you need to figure how to get the last non zero value, and then use it to validate against the values in your table.

    For good practices, you need to do this in a "single statement" to avoid problems of concurrency.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2