Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Recursive Query in HANA

Hello,

In SQL SERVER i have a recursive query to compose a tree of Bill of materials SAP B1.

Please can you tell me how I can get the same query in HANA?

WITH RecursiveSQL as (

    SELECT 1 as Level,OITT.Code as ABSCODE,OITT.Code,ITT1.Code as ITEMCODE,ITT1.Quantity FROM OITT INNER JOIN ITT1 ON OITT.Code = ITT1.Father

    UNION ALL

    SELECT RecursiveSQL.Level + 1 as Level, RecursiveSQL.ABSCODE, OITT.Code,ITT1.Code as ITEMCODE,ITT1.Quantity FROM RecursiveSQL INNER JOIN OITT ON RecursiveSQL.ITEMCODE = OITT.Code INNER JOIN ITT1 ON OITT.Code = ITT1.Father

)

SELECT * FROM RecursiveSQL WHERE ABSCODE = '0021142-5252-3-00XXL' Order by Level

Many Thanks for your help.

Tags:

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question