[Solved] Sum total of column in database

Discuss the database features

[Solved] Sum total of column in database

Postby MikeG123 » Sun Feb 26, 2017 6:23 am

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?
Last edited by Hagar Delest on Mon Feb 27, 2017 2:47 pm, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 4 Windows 8
MikeG123
 
Posts: 8
Joined: Sat Aug 16, 2014 11:32 am

Re: Sum total of column in database

Postby charlie.it » Sun Feb 26, 2017 1:06 pm

Ciao, please compare your database with mine.
Attachments
Test.odb
(4.79 KiB) Downloaded 104 times
charlie
macOS 10.12 Sierra: Open Office 4.1.5 - LibreOffice 5.4.3.2
Windows 7 pro (VirtualBox): Open Office 4.1.5 - LibreOffice 5.4.4.2
Ubuntu 17.04 LTE (VirtualBox): LibreOffice 5.1.6.2
http://www.charlieopenoffice.altervista.org
User avatar
charlie.it
Volunteer
 
Posts: 311
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy

Re: Sum total of column in database

Postby MikeG123 » Mon Feb 27, 2017 5:19 am

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
Attachments
Screenshot (2).png
Screenshot (3).png
Test.odb
(3.17 KiB) Downloaded 37 times
OpenOffice 4 Windows 8
MikeG123
 
Posts: 8
Joined: Sat Aug 16, 2014 11:32 am

Re: Sum total of column in database

Postby robleyd » Mon Feb 27, 2017 7:27 am

The difference is that charlie.it has used decimal fields (numeric) whereas you have used text fields (string).
Cheers
David
Apache OpenOffice Developer Build 4.2.0 9820 - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 2733
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Sum total of column in database

Postby MikeG123 » Mon Feb 27, 2017 11:25 am

Hooray, that was it!
Thank you David and Charlie.it.
OpenOffice 4 Windows 8
MikeG123
 
Posts: 8
Joined: Sat Aug 16, 2014 11:32 am


Return to Base

Who is online

Users browsing this forum: AlgonquinPeak and 5 guests