Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

HANA - Finding maximum in a row

Hi Expert,

I have a requirement to get the maximum value comparing multiple columns in a row. This has to be done in a HANA Stored Procedure code. The columns are around 10 so case statement is not feasible. Please suggest an alternate solution.

Example below:

NameDate 1Date 2Date 3Date 4Date 5Max Date
A14-Jan-165-Jan-166-Jan-167-Jan-168-Jan-168-Jan-16
A24-Jan-165-Jan-166-Jan-167-Jan-168-Feb-168-Feb-16
A34-Jan-165-Jan-166-Apr-167-Jan-168-Feb-166-Apr-16

In the 1st row 8th Jan is the max amongst the 5 date so its displayed , similarly for the 2nd row 8th Feb while for 3rd row 6th April gets displayed.

Thanks,

Anupama

Tags:
Former Member
Former Member replied

In your SQL manual have a look at keyword GREATEST.

regards

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question