Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Sir,

I have first_name, last_name in table Student_Details.

i want to display those two fields as one field.

(Exapmle: Prasad Guduri )

with alias name Full Name.

How ?

Please help me.....!!!!

Thanks N Regards

Prasad Guduri
Posted

You can concatenate the columns and define an alias to the result set column. For example
SQL
SELECT FirstName + ' ' + LastName  AS FullName
FROM YourTable
 
Share this answer
 
Comments
Amir Mahfoozi 4-Feb-12 4:12am    
+5
Wendelius 4-Feb-12 4:21am    
Thanks :)
Abhinav S 4-Feb-12 4:36am    
5 of course.
Wendelius 4-Feb-12 6:41am    
Thanks :)
Try select first_name + ' ' + last_name as "Full Name" from Student_Details.

You can also use the COALESCE operator.
 
Share this answer
 
Comments
Wendelius 4-Feb-12 4:21am    
Indeed, 5 :)
Prasad Guduri 4-Feb-12 4:44am    
Thanks alot....!!!!
Abhinav S 4-Feb-12 4:46am    
You are welcome. Mark as answered if it helped.
User concatination Like Mika Wendelius , and if you have FirstName empty and LastName haveing value then use concatination operator with iif or case statemend ....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900