Updating getGID SQLQuery