test

来源:互联网 发布:mac如何不在桌面显示 编辑:程序博客网 时间:2024/05/22 13:19

SELECT [captain_id],DATEPART(yy,[utc_time_stamp]) as 'year',
       DATEPART(mm,[utc_time_stamp]) as 'month',
       DATEPART(dd,[utc_time_stamp]) as 'day',
       count(vehicle_speed) as 'vehicle_cnt',
       SUM(vehicle_speed) as 'vhicle_sum',
       COUNT(gps_speed) as 'gps_cnt',
       SUM(gps_speed) as 'gps_sum'
    INTO [Feature_Ex].[dbo].[position_logs_driver_sts]
    FROM [position_log].[dbo].[position_logs]
    where [utc_time_stamp]<='2014-12-31'    
    group by all captain_id,
                 DATEPART(yy,[utc_time_stamp]),
                 DATEPART(mm,[utc_time_stamp]),
                 DATEPART(dd,[utc_time_stamp])    
    order by captain_id;

SELECT [captain_id],
       DATEPART(yy, dateadd(hh,8,[time_stamp])) as 'year',
       DATEPART(mm,dateadd(hh,8,[time_stamp])) as 'month',
       DATEPART(dd,dateadd(hh,8,[time_stamp])) as 'day',
       count(vehicle_speed) as 'vehicle_cnt',
       SUM(vehicle_speed) as 'vhicle_sum',
       COUNT(gps_speed) as 'gps_cnt',
       SUM(gps_speed) as 'gps_sum'  
    INTO [Feature_Ex].[dbo].[position_logs_driver_sts_old]
    FROM [SMRT_BIG_DATA].[dbo].[position_logs]
    where dateadd(hh,8,[time_stamp])<'2014-6-30'    
    group by all captain_id,
                 DATEPART(yy,dateadd(hh,8,[time_stamp])),
                 DATEPART(mm,dateadd(hh,8,[time_stamp])),
                 DATEPART(dd,dateadd(hh,8,[time_stamp]))    
    order by captain_id;
0 0
原创粉丝点击