How to concat datatypes like integers(integer with integer) & varchar(varchar with varchar) in mysql?

前端 未结 3 1481
鱼传尺愫
鱼传尺愫 2020-12-25 11:52

How can we concat

  1. integers with integers
  2. varchar with varchar
  3. int with varchar

in MySQL ?

3条回答
  •  孤城傲影
    2020-12-25 12:17

    if the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:

    SELECT CONCAT(CAST(int_col AS CHAR), char_col);
    

    5.1 Documentations

提交回复
热议问题