将输出数据插入新表

时间:2018-11-16 08:05:05

标签: mysql mysql-error-1292

我想插入查询的输出,但是我无法插入输出,但由于ER_TRUNCATED_WRONG_Name(1292)错误而被截断-错误的DOUBLE值被截断:'Null'

insert into grid SELECT
  (CASE
  WHEN sample.Airtel = 'Null' THEN'0'
  WHEN sample.Airtel <'1000' THEN '1'
  WHEN sample.Airtel >'2933' THEN '3'
ELSE '2'
  END) AS airtel1,

  ( CASE
  WHEN sample.Jio = 'Null' THEN'0'
  WHEN sample.Jio <'1000' THEN '1'
  WHEN sample.Jio >'2933' THEN '3'
ELSE '2'
  END )AS jio1,

  ( CASE
  WHEN sample.Vodaidea = 'Null' THEN'0'
  WHEN sample.Vodaidea <'1000' THEN '1'
  WHEN sample.Vodaidea >'2933' THEN '3'
ELSE '2'
  END )AS voda1,

  ( CASE
  WHEN sample.Airtel_count = 'Null' THEN'0'
  WHEN sample.Airtel_count >'32' THEN 'High'
  WHEN sample.Airtel_count <='1' THEN 'Low'
ELSE 'Mid'
  END) AS airtelgrid,

    ( CASE
  WHEN sample.Jio_count = 'Null' THEN'0'
  WHEN sample.Jio_count >'32' THEN 'High'
  WHEN sample.Jio_count <='1' THEN 'Low'
ELSE 'Mid'
  END) AS jiogrid,

   (  CASE
  WHEN sample.VodaIdea_count = 'Null' THEN'0'
  WHEN sample.VodaIdea_count >'32' THEN 'High'
  WHEN sample.VodaIdea_count <='1' THEN 'Low'
ELSE 'Mid'
  END) AS vodagrid,

  sample.*
FROM
  sample

表定义如下:

CREATE TABLE `grid` (
  `Hex_id` int(50) DEFAULT NULL,
  `Airtel` int(50) DEFAULT NULL,
  `Airtel_count` int(50) DEFAULT NULL,
  `Jio` int(50) DEFAULT NULL,
  `Jio_count` int(50) DEFAULT NULL,
  `Vodaidea` int(50) DEFAULT NULL,
  `VodaIdea_count` int(50) DEFAULT NULL,
  `airtel1` int(50) DEFAULT NULL,
  `jio1` int(50) DEFAULT NULL,
  `voda1` int(50) DEFAULT NULL,
  `airtelgrid` varchar(50) DEFAULT NULL,
  `jiogrid` varchar(50) DEFAULT NULL,
  `vodagrid` varchar(50) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1

样本表定义如下:

创建表sample(       Hex_id int(50)NOT NULL,       Airtel int(50)NOT NULL,       Airtel_count int(50)NOT NULL,       Jio int(50)NOT NULL,       Jio_count int(50)NOT NULL,       Vodaidea int(50)NOT NULL,       VodaIdea_count int(50)非空     )ENGINE = MyISAM DEFAULT CHARSET = latin1

0 个答案:

没有答案