请帮忙......
我正在尝试使用SQL从我的网站www.mentallica.co.il获取流量数据 问题是当我使用两个或更多时,我的左连接查询返回不同的值。
SELECT ISNULL(SUM([TrafficDay].UniqueTraffic), 0) AS TrafficDay,
[Topics].topicNumber
FROM [Topics]
LEFT JOIN [Traffic] AS TrafficDay
ON ([TrafficDay].Date >= '10/16/2013'
AND [TrafficDay].Date <= '10/16/2013')
AND [TrafficDay].TopicNumber = [Topics].TopicNumber
GROUP BY [Topics].TopicNumber
将返回TrafficDay
实际值
问题查询是
SELECT ISNULL(SUM([TrafficDay].UniqueTraffic), 0) AS TrafficDay,
ISNULL(SUM([TrafficWeek].UniqueTraffic), 0) AS TrafficWeek,
[Topics].topicNumber
FROM [Topics]
LEFT JOIN [Traffic] AS TrafficDay
ON ([TrafficDay].Date >= '10/16/2013'
AND [TrafficDay].Date <= '10/16/2013')
AND [TrafficDay].TopicNumber = [Topics].TopicNumber
LEFT JOIN [Traffic] AS TrafficWeek
ON ([TrafficWeek].Date > '10/09/2013'
AND [TrafficWeek].Date < '10/16/2013')
AND [TrafficWeek].TopicNumber = [Topics].TopicNumber
GROUP BY [Topics].TopicNumber
这将为TrafficDay
为什么?
如何获得TrafficDay
和TrafficWeek
的实际值?
任何解决方案都会很棒! 如何根据其他表值加入同一个表...
答案 0 :(得分:0)
您是否尝试通过右键单击任何视图并选择“新视图”来临时创建新视图,然后将查询复制并粘贴到下面的框中。从那里你将有一些查询的Access视图,并且可以更好地可视化和更改您的连接,即表之间的箭头。只是一个建议。有时对我有用。祝你好运。