所以我要解决的问题是我有 8 个表,其中包含数据。第 9 个表,每个表都有一个字段,我想存储前 8 个表中的每一个的计数。我能够返回计数,但是不是每个字段一个计数,我有 8 行只是填充第一个字段。8 个表名中的每一个都是第 9 个表中的一个字段名。这是我的代码:
SELECT COUNT(SubID) as Sent_Members FROM Sent_Members
UNION ALL
SELECT COUNT(SubID) as Sent_Shoppers FROM Sent_Shoppers
UNION ALL
SELECT COUNT(SubID) as Open_Members FROM Open_Members
UNION ALL
SELECT COUNT(SubID) as Open_Shoppers FROM Open_Shoppers
UNION ALL
SELECT COUNT(SubID) as Click_Members FROM Click_Members
UNION ALL
SELECT COUNT(SubID) as Click_Shoppers FROM Click_Shoppers
UNION ALL
SELECT COUNT(SubID) as Unique_Click_Members FROM Unique_Click_Members
UNION ALL
SELECT COUNT(SubID) as Unique_Click_Shoppers FROM Unique_Click_Shoppers
我猜我应该使用一些东西而不是 Union,但我不确定那会是什么.. 谢谢!