Help - I'm a Novice - SQL Query Problem
-
I am trying to combine several columns from one table: The First Name, Last Name, Middle Name, City, State. I want to Combine the first, last, and middle names and then have a varying amount of spaces between it and the city and state. All of these will be combined into one column and displayed in a listbox. For Example: Problem: John Smith Los Angeles, CA Johnathan Smith Los Angeles, CA Solution: HOW! John Smith Los Angeles, CA Johnathan Smith Los Angeles, CA
-
I am trying to combine several columns from one table: The First Name, Last Name, Middle Name, City, State. I want to Combine the first, last, and middle names and then have a varying amount of spaces between it and the city and state. All of these will be combined into one column and displayed in a listbox. For Example: Problem: John Smith Los Angeles, CA Johnathan Smith Los Angeles, CA Solution: HOW! John Smith Los Angeles, CA Johnathan Smith Los Angeles, CA
-
Asuuming all are varchar or char(n) select FirstName + ' ' + LastName + ' ' + MiddleName + ' ' + City + ' ' + State from yourtable.
You might wanna check for null, b/c if any of the field is NULL then the resultant is NULL. Use TSQL function IsNull() function. Farhan Noor Qureshi if (this == this) thow this;
-
You might wanna check for null, b/c if any of the field is NULL then the resultant is NULL. Use TSQL function IsNull() function. Farhan Noor Qureshi if (this == this) thow this;