Hi,
I'm having problem to produce one SQl in DB2 as i'm novice into it.
Let's consider the sample input data as follows -
Sample Query -
Code:
Select LINKS.AUDITABLE_LINK.TARGET_REF_REFERENCED_ITM_TM_D,
LINKS.AUDITABLE_LINK.SOURCE_REF_REFERENCED_ITM_TM_D
From LINKS.AUDITABLE_LINK;
And, the output is as follows (Also this is my initial input sample data) -
Code:
TARGET_REF_REFERENCED_ITM_TM_D SOURCE_REF_REFERENCED_ITM_TM_D
_juEr8G7iEd-9NLREWheBlA _hL9UgG7iEd-9NLREWheBlA
_VY7zUG-bEd-0e-e4Zg0prg _VgcJgG-bEd-0e-e4Zg0prg
_hL9UgG7iEd-9NLREWheBlA _VY7zUG-bEd-0e-e4Zg0prg
And, my required output is -
Code:
TARGET_REF_REFERENCED_ITM_TM_D SOURCE_REF_REFERENCED_ITM_TM_D
_juEr8G7iEd-9NLREWheBlA _hL9UgG7iEd-9NLREWheBlA
_hL9UgG7iEd-9NLREWheBlA _VY7zUG-bEd-0e-e4Zg0prg
_VY7zUG-bEd-0e-e4Zg0prg _VgcJgG-bEd-0e-e4Zg0prg
As, you can see that in my output, i've arranged all the records based on the parent -child relationship where TARGET_REF_REFERENCED_ITM_TM_D (parent) & SOURCE_REF_REFERENCED_ITM_TM_D (Child).
Kindly let me know the possible way to solve this problem. Thanks for your time.
Regards.