0
I want to select and instead of receiving the top number I want his name which is nm_depto. How can I do this?
SELECT d.id_numero_depto, d.nm_depto, d.id_numero_depto_superior FROM tb_depto AS d;
0
I want to select and instead of receiving the top number I want his name which is nm_depto. How can I do this?
SELECT d.id_numero_depto, d.nm_depto, d.id_numero_depto_superior FROM tb_depto AS d;
0
I got it, that was the code:
select d1.id_numero_depto, d1.nm_depto, d2.nm_depto from tb_depto d1, tb_depto d2 where d1.id_numero_depto_superior = d2.id_numero_depto and d1.id_numero_depto_superior is not null;
Browser other questions tagged mysql
You are not signed in. Login or sign up in order to post.
You want to change the column name from "id_numero_depto_superior" to "nm_depto" on the return of your query?
– Filipe Ricardo
Yes, the corresponding figure
– Alexandre Saura
You will need to make a relationship, which is the name of the table that will have the nm_depto information?
– Filipe Ricardo
the table is the same for both.
– Alexandre Saura
Isac did not understand
– Alexandre Saura