I would like to extract highest value row for each report_type_code. I have tried below sql query. On top of this, i need a condition to extract max value for each report_type_code.
SELECT gfrb.report_type_code,
gfrb.report_folder,
Max (gfrb.object_version_number) "MAX"
FROM gl_frc_reports_b gfrb
WHERE gfrb.report_path LIKE '%REP514%'
GROUP BY gfrb.report_type_code,
gfrb.report_folder
Output
REPORT_TYPE_CODE | REPORT_FOLDER | MAX |
---|---|---|
Analysis | /shared/Custom/ | 10 |
Analysis | /shared/Custom/Transaction | 2 |
Dashboard | /shared/Custom/Transaction | 1 |
Dashboard | /shared/Custom/Transaction | 4 |
Dashboard | /shared/Custom/Transaction | 3 |
Expected Output
REPORT_TYPE_CODE | REPORT_FOLDER | MAX |
---|---|---|
Analysis | /shared/Custom/ | 10 |
Dashboard | /shared/Custom/Transaction | 4 |
How can add additional condition to extract max value in above sql query?