I'm trying to find distinct orders based on the modified date. I want to sort it and find the latest modified order.
I tried to do as in postgreSQL.
select distinct on (orders) * from the table
;
But this throws an error in case of mariaDB
Orders Modified Date
------ ---------------
23031185 2019-09-24 19:36:51
23031185 2019-09-24 22:01:57
23031185 2019-09-24 19:32:28
23031185 2019-09-24 19:33:25
23031185 2019-09-24 19:33:18
The expected output should be the latest one
Orders Modified Date
------ ---------------
23031185 2019-09-24 22:01:57
I also have other columns. I need to get all distinct rows based on orders column with all other columns.