Reputation: 49
I have joined two columns, first name\last name into one and named it with an alias which is all good. But how do I put a space between first and last name?
au.first_name || au.last_name Name
Upvotes: 4
Views: 20581
Reputation: 21
if your working on sql server try the below 2
select au.first_name+ ' '+ au.last_name as Name from yourtablename
but in this case if you have null values in either of the columns then none of the records will be shown, instead Null will be shown.
or use
select concat(au.first_name, ' ', au.last_name) as Name from yourtablename-
unlike +, concat will replace null with an empty string. so atleast one name will be shown.
hope this helps such queries being googled
Upvotes: 2
Reputation: 1
--Combining the Client Address in one column and have comma separating the value.
(SELECT (Client.STREET+','+Client.CITY+','+Client.STATE+','+Client.ZIP))AS ClientAddress,
Upvotes: -3
Reputation: 6477
You can add the space in the same manner that you have concatenated the first and last names,
au.first_name ||' ' || au_last_name name
Upvotes: 4