Fixed sql errors for property view