Feed Rss



Feb 27 2008

Concatenation

category: Snippets,SQL author:

Concatenating in SQL is pretty simple, it's purpose is to connect fields and string together as one string, like so.

If you have a database table field called forename and you would like to have the word MR before each name, this is how it would be done.

SELECT CONCAT('Mr. ', forename) FROM table;

You can also pass as many arguments as you like through this function, for example.

SELECT CONCAT('Mr. ', forename, ' ', surname, ' - ', jobTitle) FROM table;

tag:

One Response to “Concatenation”

  1. ????? says:

    thanks

Leave a Reply