It isn't clear exactly what you're after here (based your sample output anyway). If you want duplicate names to be listed together you just need to use 'ORDER BY name' at the end of your query and it will be listed in alphabetical order by the name column.
since i am using this in php to fetch from database , when i select option from my dropdown with duplicate value should appears only once for eg Himanshu and when the Himanshu is selected then o/p should be as
and when option supriya is selected then my o/p should be as
If you're in one of those predicaments where cls.__private attributes just aren't enough since they can easily be accessed through inst._cls__private, and you need something a little more secure, here's ...