I can't c.render_sql (tree) where sql

i can’t write english.

So I’m writing about was.

I’m using tree.

But in c.render_sql ‘where’ statement, did not operate in a store for.

SELECT CD, ID, PARENT, NM 
FROM 
   (SELECT A.CD, A.CD AS ID, '0' AS PARENT, A.NM FROM CODE A 
 UNION ALL 
 SELECT A.CD, NVL(Z.NO,'!@#$') AS ID,NVL(Z.CD,A.CD) AS PARENT, NVL(Z.NM,'등록된 것이 없습니다') AS NM 
   FROM CODE A  
 INNER JOIN code_INFO Z
        ON Z.NO||Z.RE_DATE IN (SELECT MAX(C.NO||C.RE_DATE) FROMcode_INFO C WHERE C.NO=Z.NO)  AND A.CD=Z.CD  
)   
ORDER BY 1,3,2 ASC

Roughly this way, typing and query.

SELECT CD, ID, PARENT, NM 
FROM 
   (SELECT A.CD, A.CD AS ID, '0' AS PARENT, A.NM FROM CODE A 
 UNION ALL 
 SELECT A.CD, NVL(Z.NO,'!@#$') AS ID,NVL(Z.CD,A.CD) AS PARENT, NVL(Z.NM,'등록된 것이 없습니다') AS NM 
   FROM CODE A  
 INNER JOIN code_INFO Z
        ON Z.NO||Z.RE_DATE IN (SELECT MAX(C.NO||C.RE_DATE) FROMcode_INFO C WHERE C.NO=Z.NO)  AND A.CD=Z.CD  
)   
 AND PARENT='0' ORDER BY 1,3,2 ASC

Bottom ‘AND PARENT = 0’, due to the sticking error

‘where’ statements already determined not like the weapon, I think.
Inside the ‘where’ statement is written to allow a write What can I do?

Even if you try to do the program too complex to modify let go of his hand.
I hope you help me.

The SQL which you are using is way to complex.

There are two possibilities

a) I can provide a version of connector which will use your code as is, without any modification ( so you will need to care about parent-id on your own ) - it may work for plain requests but will not work for tree, which uses recursion.

b) You can create a view in database based on your original sql code and use render_table with such view. In such case complexity of sql request will be hidden by view.