Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Recursive Query in HANA

$
0
0

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.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>