if database is readonly for you then. there is not alternative, if you can update triagroup column with some data then it could be fine.
But in case of readonly database we do following.
Identify common pattern in groupname. like lets take first 3 character from group name
so hopefully we get ABP, CIB, BAF (not BAFF as we take only 3 chars)
then this way we can expected output.
but are you sure first 3 letters will be our required master groups?
it works.. thanks alot sir.. your code structure will be a good guide for my future developments.. between just got to know that GroupID had been changed to master groupid in new database where I doesn't need to select first 3 letters..:) :)