截断了错误的DOUBLE值:“-”

时间:2018-11-28 01:23:36

标签: mysql

我是mysql新手。我试图将两列之间用-组合在一起,但是却遇到了错误。如果有人可以给我建议,我将不胜感激。我在这部分出现错误:,x_end_year +"-" +x_start_month+"-01",

  

错误代码:1292       截断了错误的DOUBLE值:“-”

INSERT INTO earning (id, dateCreated, dateModified, x_t_name, x_start_date, 
                     x_end_month, x_address, x_category, x_pic, x_promo_space, 
                     x_start_month, x_space_query, x_organizer, x_end_date, 
                     x_address_query, x_current_pic, x_start_year, x_end_year,
                     x_event_title, x_pix_name),

SELECT x_idx, dateCreated, dateModified, "" , x_end_year +"-" +x_start_month+"-01",
       x_end_month, "address1", "", x_current_pic, "", x_start_month, "''", "", 
       x_end_year +"-" +x_end_month+"-01", "'address1'", x_current_pic, x_end_year, 
       x_end_year, "", ""
FROM Sale
WHERE id = 'x1'

1 个答案:

答案 0 :(得分:1)

您只需要使用CONCAT。这是一个示例。

SELECT CONCAT (column1, column2, '-', column3, column4)