start in database and I have a question, suppose I have a table called WORLD that has the following values:
I want to get the following result:
Could you please support me as to how this consultation would be carried out, thank you very much, I thank you
The following query:
select case when Pais is null then CONTINENTE else ' ' || Pais end as
Consulta
from
(
select distinct CONTINENTE, null as Pais from PAIS
union
select CONTINENTE, Pais from PAIS
) D
Return me as follows:
And would you look for a continent to appear only once, any suggestions?
When performing the Query indicated by Miguel:
select case when Pais is null then CONTINENTE else ' ' || Pais end as Consulta from ( select distinct CONTINENTE, null as Pais from PAIS union select CONTINENTE, Pais from PAIS ) D;
I get this, only that it appears at the end of each series and I do not understand very well how to make it appear at the beginning