Updating getGroups SQLQuery