I have two tables.
table 1
| Column A | Column B |
|---|---|
| rgz | 1 |
| dry | 1 |
| vgy | 2 |
| chy | 3 |
| pom | 2 |
table 2
| Column C | Column D |
|---|---|
| tuv | 10 |
| tuv | 11 |
| chx | 22 |
| lmn | 34 |
I want the following result shown on data output of postgres PgAdmin
| Column E | Column F |
|---|---|
| 1 | tuv |
| 2 | chx |
| 3 | lmn |
I just want to be able to select distinct values from column B of table 1 and column C of table 2 and show the results as above. I do not want all possible combinations which I can get by the following query
select * from (select distinct column B from table 1) a, (select distinct column C from table 2) b Can you please suggest a way to do this?
Thank you
G.