Home » SQL & PL/SQL » SQL & PL/SQL » Relation between two gold
Relation between two gold [message #671298] Tue, 21 August 2018 05:27 Go to previous message
purnima1
Messages: 79
Registered: June 2014
Member
hi all,

I have one table with following data .
Now We have two columns in this table gold_id(G1) ,rel_gold_id (G2)

I want a new column namely "gold_relation" which will define hierarchical relation between above mentioned columns

for eg: g1 > g2
g1 >g2 >g3
g1 > g4
g1 >g2

and so on ......

At some places I have observed there is duplicate relation . Do I need to remove those remove this duplicate data before defining relation.
Also in this scenario luckily all the rows have same gold_id(G1) but this is not always a case.

could you please help how I can start creating relations


CREATE TABLE MANUAL_REVIEW_ENT
(
  RNK                NUMBER,
  MATCH_GROUP_ID     NUMBER,
  PRIORITYSCORE      NUMBER,
  SOURCE_SYS_ID      VARCHAR2(20 CHAR),
  GOLD_ID            NUMBER,
  SOURCE_SYS_CD      VARCHAR2(20 CHAR),
  REL_SOURCE_SYS_ID  VARCHAR2(20 CHAR),
  REL_GOLD_ID        NUMBER,
  REL_SOURCE_SYS_CD  VARCHAR2(20 CHAR)
);

Insert statements here
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Joining multiple rows and creating multiple columns
Next Topic: Running settlement of inward vs outward quantity
Goto Forum:
  


Current Time: Tue Apr 16 12:29:03 CDT 2024