SQL: Fix sql error (thx @Sar777) and endline