I have duplicate images saved in different directories. Because every image location is stored in the database I want to remove duplicate rows of data. I can use this query to look for duplicate image locations in the same directory:
SELECT *
FROM page_additional_images
GROUP BY image_loc
HAVING COUNT(image_loc) > 1
But, it won't work for images in different directories e.g. cars
& cars4
.
/images/**cars**/hispano-suiza-k6-pictures-and-wallpapers/hispano-suiza-k6.jpg
/images/**cars4**/hispano-suiza-k6-pictures-and-wallpapers/hispano-suiza-k6.jpg
How can I take the query above and look for duplicates ignoring everything before the last "/
"?
I want to explode each row by "/" and only query the last element in each array.