How to Concat two column in a select statement sql server 2005?
Here is my statement Select FirstName,secondName from Table
...
Now i did try concating secondName
with FirstName
by using
Select FirstName + ' ' + secondName from Table
But some values are NULL
in secondName column for some records.. My select statement
returns NULL
instead of FirstName
.. I want to have FirstName
if secondName is NULL
..
MySQL CONCAT() Function The CONCAT() function adds two or more expressions together. Note: Also look at the CONCAT_WS() function.
We can use a literal in CONCAT Function. A literal is a number, character, or date that includes the SELECT statement.
Procedure. Create two or more queries to select the data you want to merge, then specify the keyword UNION between the queries. In the following figure, the first query selects the department name and number from the Q.ORG table and creates a column that displays the words WAITING FOR WORK.
SELECT FirstName + ISNULL(' ' + SecondName, '') from Table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With