Hi Rick,
Thanks for spending your valuable time on this issue. 
Sorry if I ask the same question again.

Could you please help me on this ?
ex:
select colName from tableName where id=100 having COUNT(*) > 1
When I go through the nodes, I can see the where clause and having clause
both have defined in a same way (node tree structure). 

Both doesn't have parent node. Both are using BinaryRelationalOperatorNode
as parent node if, both have the condition with some operator (like = in
where clause and > in having clause).

But, for differentiate these two we don't have any parent node.
For example if we take a look at from or groupby or orderby they have root
nodes like fromlist, groupbylist and orderbylist.

for where clause and having clause both doesn't have parent node.
-----------------
        whereClause:            
                
org.apache.derby.impl.sql.compile.BinaryRelationalOperatorNode@35b835b8
                operator: =
                methodName: equals
                dataTypeServices: null
                leftOperand:                    
                        
org.apache.derby.impl.sql.compile.ColumnReference@33c433c4
                        columnName: ID
                        tableNumber: -1
                        columnNumber: 0
                        replacesAggregate: false
                        replacesWindowFunctionCall: false
                        tableName: null
                        nestingLevel: -1
                        sourceLevel: -1
                        dataTypeServices: null
                rightOperand:                   
                        
org.apache.derby.impl.sql.compile.NumericConstantNode@34a434a4
                        value: 100
                        dataTypeServices: INTEGER NOT NULL
        havingClause:           
                
org.apache.derby.impl.sql.compile.BinaryRelationalOperatorNode@24622462
                operator: >
                methodName: greaterThan
                dataTypeServices: null
                leftOperand:                    
                        org.apache.derby.impl.sql.compile.AggregateNode@73c273c2
                        aggregateName: COUNT(*)
                        distinct: false
                        operator: null
                        methodName: null
                        dataTypeServices: null
                rightOperand:                   
                        
org.apache.derby.impl.sql.compile.NumericConstantNode@23722372
                        value: 1
                        dataTypeServices: INTEGER NOT NULL
-----------------------------

If I provide any conditional operator like AND or OR to where clause or
having clause, then the structure is different for both of these two.

My problem is, I want to take having clause data and where clause data from
the query.

So, not able to get the data properly due to the structure is changing for
these two items every time.

Is there any way to differentiate these two elements ?
or can we add any parent node for these two like others?
If not possible could you please give some advice on 'where I need to change
or which way I need to move' for solving my issue ?

Thanks in advance,
Venu.




--
View this message in context: 
http://apache-database.10148.n7.nabble.com/Using-ASTParser-and-TreeWalker-for-parsing-SQL-query-tp131219p132167.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Reply via email to