changed sql output to replacing syntax