Results 1 to 4 of 4

Thread: Sorting database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106

    Question

    in my database, i have the user put in people's name as a field. ex. "Micheal Johnson", i would like to sort all of the database using people's last name. I dont know how to do this with sql.

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Add a field to your table for storing Last name (or replace the single name field with 2 or 3 ).

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106

    Exclamation

    thanks for replying but that cannot be done because my program mostly based on full name...

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Yes it can be done, you just need to concatenate the fields together when you retrieve the data. Let's assume you've used Name as your current field.

    Change the name of "Name" to "lastname" in your database.
    If you add two more fields, "firstname" and "initial".

    To retrieve all the following fields in one, use the following SQL:

    select firstname + ' ' + initial + ' ' + lastname as name from table

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width