How to assign specific columns to the fields of a query ?

First of all , I’ve created the query (this query contains 4 fields)
then after the creation I’ve create in the “C” Column a Sum function
Then I’ve hit the refresh range and suddenly the Column of the Sum function is removed and the third field of the query was assigned automatically for this C column.

Help Please
Best Regards.

You are going to have to provide significantly more details. Operating system, LO version, file format, and probably even a sample file so we can determine what has gone wrong. In answer to your title: Insert > Names > Define… then use the name in the query field.

Im using the Fedora 18 , LO 3.6.6.2… the file format is .ods that use an ODB database .odb

the problem is when I hit the refresh range all the columns made manually will be replaced by the query’s fileds… If you didnt Understand my problem I can attach the files.

I think you are going to have to provide a sample file. I did not realise you were using a database to query against.

Unclear from the data but it seems you have designed a query, then you are running the query and getting the results, and THEN attempting to create calculations from it.

If that’s the case, just redesign the query. Add extra columns with the calculations already included. You aren’t limited in designing a query to only pulling existing columns from your database; you can create columns “on the fly” from the data in the other columns, and the extra columns you design will be generated as part of the query results. (You don’t even have to have them visible—you can just have them used for criteria.) Queries are very flexible.

Have a look at Chapter 5 of this PDF: https://wiki.documentfoundation.org/images/e/e8/BH40-BaseHandbook.pdf