I have a table and i want to produce a Cartesian of that data with same table itself.
TABLE: TEMP_TEST
FROM_COL
--------------
A
B
C
If I write the below query for Cartesian then I get the output
SELECT A.FROM_COL FROM_COL1,
B.FROM_COL FROM_COL2
FROM TEMP_TEST A,
TEMP_TEST B
WHERE A.FROM_COL!=B.FROM_COL ;
output
FROM_COL1 FROM_COL2
A B
A C
B A
B C
C A
C B
But if A to B is present i don't want B to A. How I can I write a query for that?
I need the below output
FROM_COL1 FROM_COL2
A B
A C
B C