Finding data from same table

My table is : loginid name role 12 abc analyst 12 abc clerk 142 xyz clerk 142 xyz manager 1 yash manager 1 yash ceo 2 aarav president 2 aarav ceo I want to display each login id once and if …