Repeated MySQL Select statement based on integer in a record I have a table that looks something like the following.