将输出数据插入新表

qzlgjiam  于 2021-06-19  发布在  Mysql
关注(0)|答案(0)|浏览(197)

我想插入查询的输出,但无法插入我得到的输出,因为er\u truncated\u wrong\u name(1292)-truncated不正确的双精度值:“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)不为空, Airtel int(50)不为空, Airtel_count int(50)不为空, Jio int(50)不为空, Jio_count int(50)不为空, Vodaidea int(50)不为空, VodaIdea_count int(50)not null)engine=myisam default charset=latin1

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题