Change field order in the query according to the table