Help pls !!!!

Help pls !!!!

I want to perform calculations on the amounts in my 'table_faits' table, multiplying them by the corresponding coefficients. However, it's essential that this is done sequentially, starting with a specific movement type, for example 'MAT', where the amounts of all cases will be multiplied by the coefficient 'MAT'. Then we move on to the next movement type, for example 'MO', and repeat the process for all cases. This sequence continues for all movement types. In addition, we need to sort by type of entry, with two possible values, 'real' and 'budegt'.

Now what you need to know is where the data is stored.

The most important tables are Business, Table_Facts, Type_Movement and Coefficients.

First of all, here are the table compositions:

Affaires :
- N_Affaires
- Lib_Affaires
- charge_affaires
- Type_batiments
- Type_travaux

table_faits :
- Mois
- N_Affaire_faits
- Type_mouvement_faits
- montant
- qty
- type_ecriture

Type_mouvement :
- Code_type_mouvement
- Libell_type _mouvement
- Code_type_ecriture

Coefficients :
- Type_mouvement_coeff
- Poucentage


ow the links between the tables:

1st link: The fields N_Affaires and N_Affaires_faits are linked. This links the Business table and the Facts table.
2nd link: The fields Type_mouvement_faits and Code_type_mouvement are linked. This links the table_faits and Type_mouvement tables.
3rd link: The fields Code_Type_mouvement and Type_mouvement_coeff are linked. This links the tables Type_mouvement and Coefficients.

I hope I've made myself clear
If you have any questions, please don't hesitate

Thank you

We look forward to hearing from you