Skip to Content
avatar image
Former Member

Filtering by maximum date in HANA Graphical Calculation View

Hello,

Please help me with some advice.

This is my scenario. I have a table with the next relevant fields:

| GUID | NodeID | RegisterDate | ProcessingDate | value1 | value2 |
-------------------------------------------------------------------
|   1  |    1   |  2017.01.01  |   2017.01.09   |   10   |  20    |   
|   2  |    1   |  2017.01.02  |   2017.01.09   |   10   |  30    |  
|   3  |    2   |  2017.01.02  |   2017.01.10   |   10   |  40    |   
|   4  |    2   |  2017.01.02  |   2017.01.11   |   10   |  40    | 
...  

What I need is something like this:

select * from...
        where ProcessingDate = 'inputParameter(date)'                             and max(RegisterDate)
     group by NodeID

and the expected result should be:

| GUID | NodeID | RegisterDate | ProcessingDate | value1 | value2 |
------------------------------------------------------------------- 
|   2  |    1   |  2017.01.02  |   2017.01.09   |   10   |  30    |  
|   4  |    2   |  2017.01.02  |   2017.01.11   |   10   |  40    | 

So, is there a possibility to achieve this scenario using Agregation/Projection nodes in graphical calculation view or the best solution is SQL Script?

I found a solution using Rank Node, but the performance is slow.

Thanks for your attention.

Add comment
10|10000 characters needed characters exceeded

  • Your requirement is not quite clear.

    Do you want the entries that have the maximum RegisterDate per ProcessingDate or per what other grouping? Also, do you only want the very first or all that have that maximum RegisterDate?

    As for the performance issue: "performance is slow" is not providing any insight to help to improve the situation. As a developer, you should be able to provide more detailed information about where the time is spent and what part of the query processing is "slow" and what "slow" actually means.

  • Get RSS Feed

0 Answers