AJIs craetion for the query.

Database
Enthusiast

AJIs craetion for the query.

Hi,

 

We had a set of reporting queries which were using all amp operations. I have made the changes to the PI and was able to achieve the one amp operations for most of the queries. Now, there are some queries for which i am not able to get them work as one amp because of some conditions they are using. So, we came up with a plan to use AJIs which would help us.

I am trying AJIs for the first time and I need your help on the same.

Sharing my query below. Help me write an AJI for the query. By the time I am also referring AJI document.

 

SyntaxEditor Code Snippet

SELECT    GST_ARR.GST_ARR_DTL.CONF_NBR, BKG.HTL_CD, BKG.STY_CK_IN_DT,
        BKG.HTL_CITY_NM,
        BKG.HTL_STATE_CD 
FROM    GST_ARR.GST_ARR_DTL,
        GST_ARR.GST_ARR_DTL BKG 
ORDER BY BKG.STY_CK_IN_DT ASC 
WHERE    BKG.ENTERPRISE_ID = GST_ARR.GST_ARR_DTL.ENTERPRISE_ID 
    AND BKG.STY_CK_IN_DT BETWEEN GST_ARR.GST_ARR_DTL.STY_CK_IN_DT+1 
    AND GST_ARR.GST_ARR_DTL.STY_CK_IN_DT+14 
    AND GST_ARR.GST_ARR_DTL.LYTY_PGM_CD IS NOT NULL 
    AND GST_ARR.GST_ARR_DTL.HTL_CD = ? 
    AND GST_ARR.GST_ARR_DTL.STY_CK_IN_DT BETWEEN ? 
    AND ? 
QUALIFY    ROW_NUMBER() OVER(PARTITION BY GST_ARR.GST_ARR_DTL.CONF_NBR 
ORDER BY BKG.STY_CK_IN_DT ASC) < 4