modify sql processing logic