Problem to get the required table from the given table in my database. Current Table-
Gentle_R4 2017-11-14 Company 1 46000.00
Gentle_R0 2017-10-03 Company 2 45310.00
Gentle_R2_1 2017-10-22 Company 2 34500.00
Gentle_R0 2017-10-03 Company 3 48000.00
Gentle_R0 2017-10-11 Company 4 14000.00
Gentle_R0 2017-10-11 Company 5 50600.00
Gentle_R0 2017-10-11 Company 6 2900.00
Gentle_R0 2017-10-11 Company 7 67900.00
Gentle_R0 2017-10-11 Company 8 36000.00
Gentle_R2 2017-10-19 Company 8 36000.00
Need the table like-
Gentle_R4 2017-11-14 Company 1 46000.00
Gentle_R2_1 2017-10-22 Company 2 34500.00
Gentle_R0 2017-10-03 Company 3 48000.00
Gentle_R0 2017-10-11 Company 4 14000.00
Gentle_R0 2017-10-11 Company 5 50600.00
Gentle_R0 2017-10-11 Company 6 2900.00
Gentle_R0 2017-10-11 Company 7 67900.00
Gentle_R2 2017-10-19 Company 8 36000.00
I need to get the rows that contain the maximum date also for the group by company.
I tried:
SELECT
notice_type, MAX(notice_date) notice_date,company,total_amountFROMmy_tableGROUP BYcompanyORDER BYnotice_dateDESC
But get the wrong values of