4
I have 3 tables:
TABELA A
ID   ID_TABELA_B
1    188
2    189   
3    190
4    200
TABELA B
ID    ID_TABELA_C
188   22
189   22   
190   22
200   23
TABELA C
ID   NAME
22   Gato
23   Cão
Table A is linked to table B and table B linked to table C as you can see through the field FK_TABELA_[x].
It is necessary to update the table A in which the field FK_TABELA_B is equal to the largest ID of table B, but if the field FK_TABELA_C corresponds to the 'Cat' ID in table C, ie 22.
I have to use the term 'Cat' because in principle I do not know the 'Cat' ID, I used 22 only for example.
The result after the query would be:
TABELA A
ID   FK_TABELA_B
1    190
2    190   
3    190
4    200
The above result is because "190" is the largest ID in table B with the "Cat" ID in table C.
It’s complicated this...
– Jorge B.
@Jorgeb. is missing the relation with table C. It is necessary to update only the records of table A in which table C is equal to 'Cat', only that I have no relation between table A and C and table A with B and B with C, as in the example posted.
– Filipe Moraes
I got it, I deleted the comment.
– Jorge B.