I have two tables, I want to get the previous record of the recorded data from the second table based on the first one.
Tabela 1 | Tabela 2
id - hora | id - id_tabela1 - cod
1 02:30 | 1 1 1
2 02:45 | 2 2 3
3 03:00 | 3 3 1
What he wanted was to take the time difference between codes. ex.
diferenca
cod - hora
1 00:00
3 00:00
1 00:30
Does anyone know what the MySQL query would look like?