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

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

mysql - Can mysql_pconnect be called multiple times in one php page? -