sql server - FirstName, LastName in SQL, too complex? -


This SQL looks complicated, is there an easy way to get the first name when one or both fields can be taped ?

  SELECT COALESCE (last name, '') + case when last name + is not the first name then ',' end + COALESCE (first name, '') AS person by name About  
  SELECT COALESCE (LastName + ')      

If the first name or last name is not complete, then complete the first name, '+ FirstName, LastName, FirstName' Expression (, ) becomes redundant, compelling the collages to check, second, last name alone, and If Last Name is zero, finally, firstname alone.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -