Custom spells grouping like paladin auras

I have this custom spells 8 ranks:

Stances action bar: https://prnt.sc/kzvs97

Spellbook: http://prntscr.com/kzvt0r

Spell_group table: http://prntscr.com/kzvtlb

Spell_ranks table: http://prntscr.com/kzvtfb

How do I make it show in the stances bar only the latest rank not all ranks?