zoukankan      html  css  js  c++  java
  • mysql实践3

    select  sum(guid)  from `sqm`.`sqm_value_quality_station` WHERE result='PASS'
      GROUP BY station_code


    sqmdc


    select  count(guid),station_code  from `sqm`.`sqm_value_quality_station` WHERE result='PASS'
      GROUP BY day

    select  count(guid), station_code  from `sqm`.`sqm_value_quality_station` WHERE result='PASS'
      GROUP BY station_code


    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('11', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');

    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('12', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('13', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('14', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('15', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('16', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('17', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('18', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('19', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('20', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');


    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('21', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('22', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('23', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('24', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('25', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('26', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('27', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('28', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('29', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('30', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');


    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('31', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('32', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('33', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('34', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('35', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('36', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('37', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('38', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('39', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');
    INSERT INTO `sqm`.`sqm_value_quality_station` (`guid`, `date`, `year`, `month`, `day`, `supplier_code`, `module_code`, `work_order`, `line_code`, `station_code`, `serial_no`, `operator`, `result`, `generate_time`, `create_time`) VALUES ('40', '2011-10-28', '2011', '10', '28', 'sefawerr', 'werqr', 'weqrqwer', 'qwerwqer', 'station', 'asd', 'asdasd', 'PASS', '2011-10-21 13:55:32', '2011-10-21 13:55:32');


      select 
      val1.station_code beanKey,
      val1.fail beanValFail,
      val2.total beanValTotal
      from
      (
      select 
      count(guid)  fail ,
      station_code
      from
       `sqm`.`sqm_value_quality_station` 
      WHERE
      result='PASS'
      GROUP BY
      station_code
      ) 
      val1
      left join
      (
      select 
      count(guid) total,
      station_code
      from
       `sqm`.`sqm_value_quality_station`
      GROUP BY
      station_code
      ) 
      val2
      on 
      val1.station_code = val2.station_code

     select 
      val1.day beanKey,
      val1.fail beanValFail,
      val2.total beanValTotal
      from
      (
      select 
      count(guid)  fail ,
      day
      from
       `sqm`.`sqm_value_quality_station` 
      WHERE
      result='PASS'
      GROUP BY
      day
      ) 
      val1
      left join
      (
      select 
      count(guid) total,
      day
      from
       `sqm`.`sqm_value_quality_station`
      GROUP BY
      day
      ) 
      val2
      on 
      val1.day = val2.day

  • 相关阅读:
    linux系统原子操作
    linux驱动编写之进程独占驱动
    批处理文件配置网络
    linux驱动编写之中断处理
    BusyBox下tftp命令的使用
    linux应用编程之进程间同步
    linux创建线程之pthread_create
    PHP 实现自动加载
    Swoole PHP windows composer
    win7&win10 右键添加 cmd
  • 原文地址:https://www.cnblogs.com/mount/p/2258311.html
Copyright © 2011-2022 走看看