select regdate,总PV,总点击,总独立用户,总停留时间 from
(SELECT RegDate, SUM(StayCount) AS '总PV', SUM(ClickSum) AS '总点击', SUM(StayTime) AS '总停留时间' FROM trafficsum GROUP BY RegDate) as a,
(SELECT COUNT(DISTINCT IP) AS '总独立用户' FROM traffic GROUP BY RegDate) as b
where a.regdate=b.regdate
(SELECT RegDate, SUM(StayCount) AS '总PV', SUM(ClickSum) AS '总点击', SUM(StayTime) AS '总停留时间' FROM trafficsum GROUP BY RegDate) as a,
(SELECT COUNT(DISTINCT IP) AS '总独立用户' FROM traffic GROUP BY RegDate) as b
where a.regdate=b.regdate
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT RegDate, SUM( StayCount ) AS 'a1', SUM( ClickSum ) AS 我的SQL如下:
SELECT RegDate, a1, a2, b1, a3 FROM (SELECT RegDate, SUM(StayCount) AS 'a1', SUM(ClickSum) AS 'a2', SUM(StayTime) AS 'a3' FROM trafficsum GROUP BY RegDate) AS a, (SELECT COUNT(DISTINCT IP) AS 'b1' FROM traffic GROUP BY RegDate) AS b WHERE a.RegDate = b.RegDate
drop table tmp2;