How can we concat
- integers with integers
- varchar with varchar
- int with varchar
in MySQL ?
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
SELECT CONCAT(1, 2); -- "12" SELECT CONCAT('foo', 'bar'); -- "foobar" SELECT CONCAT(1, 'bar'); -- "1bar"
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);
For two columns concatenation
PIG syntax is CONCAT(name,(CHARARRAY)no);