Fixed syntax of sql