sql view to check accounting