PHP mysql select concat

后端 未结 2 769
遇见更好的自我
遇见更好的自我 2021-01-26 03:43

i have this function that shows an autosuggest in a form:

function searchbyId($params) {

    $input = strtolower($params[\'input\']);
    $len = strlen($input);         


        
2条回答
  •  一个人的身影
    2021-01-26 03:59

    CONCAT will work with strings/varchar, but not with numbers. So if primerNombre and segundNombre are INT data types, CONCAT will fail. Try using the CONVERT function:

    SELECT DISTINCT nIdentidad, 
           CONCAT( CONVERT(primerNombre, char(8)), ' ', 
                   CONVERT(segundoNombre, char(8))  ) as nombre
    

提交回复
热议问题