我有以下架构:
CREATE TABLE `todays_elevated_businesses_temp` (
`idBUSINESS` int(11) NOT NULL,
`KEYWORD_TEXT` varchar(200) NOT NULL,
`CITY` varchar(50) NOT NULL,
`BID_AMOUNT` decimal(18,2) NOT NULL,
PRIMARY KEY (`idBUSINESS`,`KEYWORD_TEXT`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `elevated_business_queue` (
`idBUSINESS` int(11) NOT NULL,
`KEYWORD_TEXT` varchar(200) NOT NULL,
`CITY` varchar(50) NOT NULL,
`BID_AMOUNT` decimal(18,2) NOT NULL,
`NO_OF_DAYS` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
以及以下查询:
INSERT INTO `clearindia`.`todays_elevated_businesses_temp`
(`idBUSINESS`, `KEYWORD_TEXT`, `CITY`, `BID_AMOUNT`)
Select `idBUSINESS`, `KEYWORD_TEXT`, `CITY`, `BID_AMOUNT` from (
SELECT @row_num := IF(@prev_value= CONCAT(o.CITY + KEYWORD_TEXT) ,@row_num+1,1) AS POSITION
,o.idBUSINESS
,o.KEYWORD_TEXT
,o.CITY
, o.BID_AMOUNT
,@prev_value := CONCAT(o.CITY + o.KEYWORD_TEXT)
FROM elevated_business_queue o,
(SELECT @row_num := 1) x,
(SELECT @prev_value := '') y
ORDER BY o.`CITY`, o.`KEYWORD_TEXT`, o.`BID_AMOUNT` DESC) as temp_tab
WHERE POSITION <11;
运行时出现以下错误:
Error Code: 1292. Truncated incorrect DOUBLE value: 'New York'
但是,当我单独运行select语句时,它可以正常工作。