I have a query where I am parsing the field name to display in PHP. I am trying to get the last 10 entries to display. The data that is in the field file_name is similar to 1_SI_777777.xls, 2_SI_777777.xls, 1_SI_888888.xls. So I parsed the #_SI_ off of the field. So then there are some values that are equal. I just want the distinct values to be displayed. What am I doing wrong?
select distinct(substring(SUBSTRING(file_name,LOCATE('_',file_name)+2),LOCATE('_',substring(file_name,LOCATE('_',file_name)+1)))) as file, date_created, status from tblfiles order by date_created desc limit 10
this is what is displayed for file:
So I don't want 777777.xls to be listed three times - just once.
Any help is appreciated.