I have a table with a list of payments. When I try to retrieve the total I get different values depending on which columns I use in the SUM().
Here is my query:
SELECT
sum(Email_Broadcasting+Custom_Email_Newsletter+Digital_Newsletter+Mortgage_Matters) as EM,
sum(Resident_Lists+Consumer_Lists+Business_Lists+Email_Lists+Specialty_Lists) as DL,
sum(Database_Services+Email_Appending+Email_Cleansing) as DS,
sum(Email_Broadcasting+Custom_Email_Newsletter+Digital_Newsletter+Mortgage_Matters
+Resident_Lists+Consumer_Lists+Business_Lists+Email_Lists+Specialty_Lists
+Database_Services+Email_Appending+Email_Cleansing) as Total
FROM payment_orders
As you can see Total should be equal to EM+DL+DS, but this is the value I get instead:
EM DL DS Total
66122.79 772030.36 55403.67 328701.27
which doesn't really add up.
Am I doing something wrong?