Write PostgreSQL string-manipulation query | Bloomberg SQL Question