Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: MAX funtionality in HANA

$
0
0

Hmm.. you didn't seem to get what I was proposing before.

The logic of your query is wrong.

 

In order to get just the records with the most current/highest/maximum date, you need to find out first - for each item - the maximum date. In a second step you can have the record's details join in.

 

Typically this is done via a subquery as I wrote above.

Really, this is SQL query 101 and not at all SAP HANA specific.

 

For this there's no point in having an information model at all. Simply do it in SQL:

 

SELECT <... here goes what you want to see of your items ...>

FROM

     table_with_items_data i inner join

     ( SELECT item_id, max(item_date) max_date

       FROM table_with_items_data

       GROUP BY item_id) im

     on i.item_id = im.item_id

 

 

- Lars


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>