Changed order of sql-query concatenation