phpmyadmin CONCAT()语句不能插入到表中

i7uaboj4  于 2022-11-09  发布在  PHP
关注(0)|答案(1)|浏览(114)

这段代码本身运行得很好,但不是INSERT INTO语句的一部分。我得到了错误:#1292 - Truncated incorrect INTEGER value: ''?我在CONCAT()函数中连接了一个字符串和一个整数。我试图插入的字段是一个VARCHAR(255)。

(SELECT CAST(CONCAT((SELECT wp_wpdatatable_2.prefix FROM wp_wpdatatable_2, wp_wpdatatable_9 WHERE wp_wpdatatable_9.client = wp_wpdatatable_2.wdt_ID AND wp_wpdatatable_9.wdt_ID = 811 LIMIT 1),         
     CASE WHEN (SELECT wp_wpdatatable_5.entryid FROM wp_wpdatatable_9, wp_wpdatatable_5 WHERE wp_wpdatatable_9.entryid = wp_wpdatatable_5.entryid LIMIT 1) 
      THEN (SELECT MAX(CAST( TRIM(LEADING '0' FROM REGEXP_SUBSTR(wp_wpdatatable_5.reference,'[0-9]+')) AS INT)) FROM wp_wpdatatable_5, wp_wpdatatable_9 WHERE wp_wpdatatable_5.client = wp_wpdatatable_9.client AND wp_wpdatatable_9.wdt_ID = 811 AND wp_wpdatatable_9.entryid = wp_wpdatatable_5.entryid ORDER BY wp_wpdatatable_5.reference DESC LIMIT 1)

      ELSE (SELECT MAX(CAST( TRIM(LEADING '0' FROM REGEXP_SUBSTR(wp_wpdatatable_5.reference,'[0-9]+')) AS INT)) + 1 FROM wp_wpdatatable_5, wp_wpdatatable_9 WHERE wp_wpdatatable_5.client = wp_wpdatatable_9.client AND wp_wpdatatable_9.wdt_ID = 811 ORDER BY wp_wpdatatable_5.reference DESC LIMIT 1) END) AS CHAR))
uoifb46i

uoifb46i1#

请为您要插入的表提供SHOW CREATE TABLE。同时提供语句的INSERT部分。我怀疑列没有对齐。或者有一个您没有考虑的AUTO_INCREMENTid

相关问题