Sum of multiple fields | AppGini 23.11

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Sum of multiple fields | AppGini 23.11

Post by Moh Youba » 2023-04-03 18:24

Hello
Please any help. I am trying to sum multiple field in a table with below formula but not working. Any solution?

SELECT SUM(`soins`.`tarif_esimple`+`soins`.`tarif_chiru`+`soins`.`tarif_compo`+`soins`.`tarif_granu`+`soins`.`tarif_pulpo`+`soins`.`tarif_detar`+`soins`.`tarif_gingi`+`soins`.`tarif_cure`+`soins`.`tarif_ceram`+`soins`.`tarif_zircom`+`soins`.`tarif_stellite`+`soins`.`tarif_resine`+`soins`.`tarif_tot_resine`+`soins`.`tarif_mob_flexible`+`soins`.`tarif_tot_fixe`+`soins`.`tarif_ortho_fixe`+`soins`.`tarif_ortho_mobile`) FROM `soins`
WHERE `soins`.`idsoin`='%ID%'

Thank you

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: Sum of multiple fields | AppGini 23.11

Post by Moh Youba » 2023-04-04 16:24

I finaly get this code from CHAT GPT and it is working fine

SELECT SUM(COALESCE(tarif_esimple, 0) + COALESCE(tarif_chiru, 0) + COALESCE(tarif_compo, 0) + COALESCE(tarif_granu, 0) + COALESCE(tarif_pulpo, 0) + COALESCE(tarif_detar, 0) + COALESCE(tarif_gingi, 0) + COALESCE(tarif_cure, 0) + COALESCE(tarif_ceram, 0) + COALESCE(tarif_zircom, 0) + COALESCE(tarif_stellite, 0) + COALESCE(tarif_resine, 0) + COALESCE(tarif_tot_resine, 0) + COALESCE(tarif_mob_flexible, 0) + COALESCE(tarif_tot_fixe, 0) + COALESCE(tarif_ortho_fixe, 0) + COALESCE(tarif_ortho_mobile, 0)) AS somme_total FROM soins;

lectura
Posts: 28
Joined: 2015-01-10 13:29

Re: Sum of multiple fields | AppGini 23.11

Post by lectura » 2023-04-15 11:57

I am pleased I was able to help you in this Calculations.

Post Reply