Page 1 of 1

[Solved] Sum total of column in database

Posted: Sun Feb 26, 2017 6:23 am
by MikeG123
This must be a simple query, but after reading through many posts on the topic I can't get it to work.
I have a table called payslips with columns including payslip_id, tax and net_pay. I want to calculate the totals for tax and net pay. I select sum in the function box for the tax field but running the query gives me SUM("tax") 0.
Please help?

Re: Sum total of column in database

Posted: Sun Feb 26, 2017 1:06 pm
by charlie.it
Ciao, please compare your database with mine.

Re: Sum total of column in database

Posted: Mon Feb 27, 2017 5:19 am
by MikeG123
Thank you Charlie, your help is much appreciated. You make it look so simple, which I'm sure it should be. I set up a database like yours, ran a sum query and got the results as shown on the screenshots attached. Can you make sense of it?
Mike

Re: Sum total of column in database

Posted: Mon Feb 27, 2017 7:27 am
by robleyd
The difference is that charlie.it has used decimal fields (numeric) whereas you have used text fields (string).

Re: Sum total of column in database

Posted: Mon Feb 27, 2017 11:25 am
by MikeG123
Hooray, that was it!
Thank you David and Charlie.it.