日期:2014-05-17 浏览次数:20626 次
with temptb
as(
select r_域名,CONVERT (VARCHAR(20),r_date ,23 )as 日期,count(1) as PV
from test
where r_域名 is not null group by r_域名,CONVERT (VARCHAR(20),r_date ,23 )
)
select t1.r_域名,sum(pv) ,
CAST(avg(pv) AS DECIMAL(18,2)) AS '日均PV'
from temptb t1 group by r_域名
WITH temptb
AS ( SELECT r_域名 ,
CONVERT (VARCHAR(20), r_date, 23) AS 日期 ,
COUNT(1) AS PV
FROM test
WHERE r_域名 IS NOT NULL
GROUP BY r_域名 ,
CONVERT (VARCHAR(20), r_date, 23)
)
SELECT t1.r_域名 ,
SUM(pv) ,
CAST(AVG(pv * 1.0) AS DECIMAL(18, 2)) AS '日均PV'
FROM temptb t1
GROUP BY r_域名
with temptb
as(
select r_域名,CONVERT (VARCHAR(20),r_date ,23 )as 日期,count(1) as PV
from test
where r_域名 is not null group by r_域名,CONVERT (VARCHAR(20),r_date ,23 )
)
select t1.r_域名,sum(pv) ,
CAST(avg(pv) AS DECIMAL(18,2)) AS '日均PV'
from temptb t1 group by r_域名