Home > Mobile >  SQL, display different items per row
SQL, display different items per row

Time:01-15

I would like to display the data from two different tables in a certain way using postgresql,but I can't think how it should be done. I am not allowed to use JOIN and nested commands The data should be displayed like this:

Country 1

user 1.1

user 1.2 .

.

Country 2

user 2.1

user 2.2

ETC...

CodePudding user response:

If your tables look like this:

id
1
2
3

Then this should work:

select concat('user 1.', id)
from Country1
union all
select concat('user 2.', id)
from Country2
  •  Tags:  
  • Related