Thread: Sorting by Name

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    3
    Rep Power
    0

    Sorting by Name


    Hi.
    I need to get a data from file io and sort by last name. My file will be first name, last name, group, age.
    I am able to read the data, but I don't know how to sort by last name.
    Please help me.
    thank you
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    select fistName, lastname, age, ....
    from [tableName]
    sort by lastname [asc | desc]
    El éxito consiste en una serie de pequeñas victorias día a día

    MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    3
    Rep Power
    0
    I am soryy, I don't know what you mean....

    Would you explain alittle bit more for me....
    thank you.
    Last edited by pinky79; January 29th, 2003 at 05:28 PM.
  6. #4
  7. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    As far as I can tell you are using a flat file to store data, in which case victors answer will not apply to the situation.

    I am assuming you are storing your 'records' for each person in some sort of Object array or Collection? If so, then you should look into the sorting options available to you using the Arrays and Collections objects. They both have sort methods that you can use. For more complex sorts you can implement your own sorting algorithm.

IMN logo majestic logo threadwatch logo seochat tools logo