oracle - How do I generate combinations based on column values in SQL? (Is this even possible?) -


i'm trying make new column in table contents based off values of existing pair of columns. if have table like(id not primary key)

id   |   value  |   new column(the column want) 1                   a:apple 1         b           a:orange 2        apple        b:apple 2        orange       b:orange 

im novice sql, insight here helpful.

btw, im using oracle if matters.

additional details: im looking pair values:values based on fact id's dont match

assuming want values id1 paired values id2, can cross-join table itself, filtered on id:

select t1.value ||':'|| t2.value my_table t1 cross join my_table t2 t1.id = 1 , t2.id = 2; 

sql fiddle.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -