Fixed sql view bug.