Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
esambath
Yak Posting Veteran
89 Posts |
Posted - 2008-09-04 : 03:42:12
|
| Please help this queryTable Name : Employee-------------------------------Emp_id Emp_name Emp_age-------------------------------1 Peter Doss 242 Peter Raj 253 Antony 304 sam Raj 405 sam kumar 25---------------------------------OUT PUT : just show the Emp_name-----------------------------Emp_name --------- Peter Antony sam |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-04 : 03:46:57
|
| SELECT DISTINCT LEFT(Emp_name,CASE WHEN CHARINDEX(' ',Emp_name) >0 THEN CHARINDEX(' ',Emp_name) ELSE LEN(Emp_name)+1 END -1) FROM YourTableEDIT:missed a space |
 |
|
|
|
|
|