Reputation: 1
I have two columns table like shown below
------------------------------------------
ID . | Value |
------------------------------------------
1 . | A1
| B1
| C1
2 . | A2
| B2
| C2
| D2
| E2
-------------------------------------------
Want to query the above table and Expected Results: Input to the query is where id=1 and id=2
-----------------------
Results
-----------------------
A1 A2
A1 B2
A1 C2
A1 D2
A1 E2
B1 A2
B1 B2
B1 C2
B1 D2
B1 E2
C1 A2
C1 B2
C1 C2
C1 D2
C1 E2
----------------------------------------------
Your input is highly appreciated. TIA.
and expecting results as shown below
Could please share some example to achieve this? Thanks.
Upvotes: 0
Views: 125
Reputation: 48770
A simple cross join should get what you get:
select
concat(a.value, b.value) as results
from my_table a
cross join my_table b
where a.id = 1
and b.id = 2
Upvotes: 1
Reputation: 3970
Try this
Select a.value, b.value
From table a full outer join
Table b on a.value<b.value
where a.id=1 and b.id=1
Upvotes: 0