本帖最后由 bjwangzhou 于 2011-04-02 13:09:28 编辑

解决方案 »

  1.   

    create view V_sum as select node_id,log_date,log_time,sum(tcp_traffic_size) as SumTcpSizefrom traffic_1_t,traffic_2_t,traffic_3_twhere node_id = '1,2,3' IN (select node_id from traffic_1_t,traffic_2_t,traffic_3_t)UNION ALL where log_date >='20100301' and log_date<='20100501'IN (select log_date from traffic_1_t,traffic_2_t,traffic_3_t)UNION ALLwhere log_time >='0000' and log_time<='1600'IN (select log_time from traffic_1_t,traffic_2_t,traffic_3_t)group by node_idorder by log_date,log_time ASClimit 1,30;/////////////
    log_date, log_time varchar
    /////////////
    node_id  int
      

  2.   

    create view V_sum as  select node_id,log_date,log_time,sum(tcp_traffic_size) as SumTcpSizefrom traffic_1_t,traffic_2_t,traffic_3_twhere node_id = '1,2,3' IN (select node_id from traffic_1_t,traffic_2_t,traffic_3_t)UNION ALL  where log_date >='20100301' and log_date<='20100501'IN (select log_date from traffic_1_t,traffic_2_t,traffic_3_t)UNION ALLwhere log_time >='0000' and log_time<='1600'IN (select log_time from traffic_1_t,traffic_2_t,traffic_3_t)group by node_idorder by log_date,log_time ASClimit 1,30;/////////////
    log_date, log_time varchar
    /////////////
    node_id int
      

  3.   

    create view V_sum as select 'node_id','log_date','log_time',sum('tcp_traffic_size') as SumTcpSizefrom traffic_1_t,traffic_2_t,traffic_3_twhere 'node_id' = '1,2,3' IN (select 'node_id' from traffic_1_t,traffic_2_t,traffic_3_t)and 'log_date' >= "20100301" and 'log_date' <= "20100501" IN (select 'log_date' from traffic_1_t,traffic_2_t,traffic_3_t) and 'log_time' = "1600" IN (select 'log_time' from traffic_1_t,traffic_2_t,traffic_3_t) group by 'node_id'order by 'log_date' ASClimit 1,30;搞定