我有一张包含付款清单的表格。当我尝试检索总计时,我得到不同的值,具体取决于我在 SUM() 中使用的列。
这是我的查询:
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
如您所见,Total 应该等于 EM+DL+DS,但这是我得到的值:
EM DL DS Total
66122.79 772030.36 55403.67 328701.27
这并没有真正加起来。
难道我做错了什么?