Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Help - I'm a Novice - SQL Query Problem

Help - I'm a Novice - SQL Query Problem

Scheduled Pinned Locked Moved Database
databasehelptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kabatlantafan7
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • K kabatlantafan7

      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

      M Offline
      M Offline
      miah alom
      wrote on last edited by
      #2

      Asuuming all are varchar or char(n) select FirstName + ' ' + LastName + ' ' + MiddleName + ' ' + City + ' ' + State from yourtable.

      F 1 Reply Last reply
      0
      • M miah alom

        Asuuming all are varchar or char(n) select FirstName + ' ' + LastName + ' ' + MiddleName + ' ' + City + ' ' + State from yourtable.

        F Offline
        F Offline
        Farhan Noor Qureshi
        wrote on last edited by
        #3

        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;

        M 1 Reply Last reply
        0
        • F Farhan Noor Qureshi

          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;

          M Offline
          M Offline
          miah alom
          wrote on last edited by
          #4

          right.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups