fixup the sql query command