- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Fetch max date and other field from the same row of a table grouped by other fields in SAP HANA
You have done partially correct but just missed one step further to get the desired result. The case where after grouping you need to pick one of the rows from the results, use rank number or rank function.
You need to partition your data based on your requirement, then order them as per your requirement again then pick the desired row.
For e.g. partition your data by Item Number and Shop Id. Then order them in descending order of Date column. Then pick the row with row number as 1
select date, Order_Number from (SELECT *, row_number() over ( partition by Item_Number,Shop_Id order by Date desc ) rownum from <Table> ) where rownum = 1;
- Related Articles
- Fetch the modified date of table in SAP HANA
- Fetch fields from table or structure in ABAP SAP
- SAP HANA row and column store table
- Transporting content from one SAP HANA system to other
- Checking all the list of fields for a table in SAP HANA
- MongoDB query for counting number of unique fields grouped by another field?
- Differentiating between row and column store table in SAP HANA database
- Searching 2 fields at the same time to fetch a specific First Name and Last Name from a table in MySQL
- Converting a Column store table to row store in SAP HANA
- How to display a specific field in array using $project in MongoDB and ignore other fields?
- Fetch unique records from table in SAP ABAP
- MySQL query to fetch the latest date from a table with date records
- Deleting from temporary table in SAP HANA
- How to perform repetitive aggregation over a field in a SAP HANA table?