How Do I Cycle Through a Column in MySQL?
Assume I have two tables as follows:
```
CREATE TABLE Example_Table(
`Number` INT PRIMARY KEY,
`Letter` CHAR(1));
CREATE TABLE Adder(
`Number` INT PRIMARY KEY,
`Value` INT);
```
And I input them with values as such
```
INSERT INTO Example_Table VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d');
INSERT INTO Adder VALUES (1,3),(2,6),(3,1),(4,2);
```
I want to cycle through the `Example_Table.Number` column by adding the `Values` in the `Adder` table. I want to create a select statement to extract the indexes of the resulting sums, but only within the range of the values under the `Example_Table`. So I can add `3` (the first value under `Adder`) to the `1` under `Example_Table.Number`, giving a new index of `4` which the `SELECT` statement will call upon. There's no issue there. I then add the `6` (under `Adder`) to the `2` under `Example_Table`, giving a new index of `8`. However, since `8` doesn't exist within the table, I'd like it to simply count 6 (so 3,4,1,2,3,4) and then cycle back to 4.
Any advice on how this could be done, please?