try this one:
SELECT *
FROM test
ORDER BY SUBSTRING(picture, LOCATE(pid, picture) + LENGTH(pid) + 1, 1) DESC
Fiddle: http://sqlfiddle.com/#!9/7a334c/3
It's a combination of various string functions readily available for MySQL
For the SUBSTRING function, it takes the string you want to get a substring of, the starting position, and the length of substring you wish to extract..
So lets break down the three parameters we used for the SUBSTRING function
1.) picture - the column that we need to extract the numbers from
2.) LOCATE(pid, picture) + LENGTH(pid) + 1 - we are locating the string containing the pid substring from the picture column, then adding the length of the pid itself so we get the "underscore" character, then adding 1 again to get the "number" for sorting.. this will return the position of the number after the pid and "underscore" character
3.) 1 - This represents the length that you need to "cut" or "extract" from the string, this will pose a problem if you have 2 digits to extract... but for now, we can work with this..
http://www.w3resource.com/mysql/string-functions/mysql-substring-function.php