I only have READ_ONLY authority for database..

trialgroup column?? how it works?

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?

yes first 3 letters can be required master groups.



$querymain="SELECT substrING(C1.GroupID,1,3) GroupID,


GROUP BY  substrING(C1.GroupID,1,3) ";

LINE 100

where  groupID like '{$rowmain['GroupID']}%'

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..:) :)