Hello...
I have a large database called 'tracking'... I have thousands of rows with fields in them that include fields called 'need' and 'delivered'...
'need' and 'delivered' are tinyInt that have 1-2 digit numbers in them...
What I want to do is query the database and get the TOTAL number of the difference between 'need' and 'delivered'...
Let's say example of two rows:
need = '20'
delivered = '5'
(the difference would be '15')
need = '18'
delivered = '4'
(the difference would be '14')
So the query would spit out => '29' (the differences added together)
Thank you for any help you can give me...
...
Adding Values from mySQL
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
untested
Code: Select all
SELECT SUM( ABS( `need` - `delivered` ) ) `sum` FROM `table_name`