I am new to sql - trying to learn. I have a specific use case and need help with the same.
I have 2 tables and i need to run a query to join those and get the data back.
Table A Parent Item Child Item Relationship Type
Table B Item Name Item ID Item Color
So, the data is in such a way, where items can have hierarchical relationship. For eg:
Item A is a parent for Item B and Item C. Item B is a parent for Item D and Item E. Item D is a parent for Item F and Item G.
I need a query where i want to provide a Child Item and get back all the Parents until its last level in the hierarchy. For eg: If i provide Item G as the input, the output should give me a list of Items D, B and A.
I don't know if CONNECT BY is something that i can use, but need help with this.
Thank you in advance.