Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    2

    Unanswered: how to sort by breaking a word

    Hi!

    I have a strange problem...I get a name(that is a combination of first and last name,seperated by a . ), is it possible that we can sort on either the first or the last name.

    Thanks is anticipation....

    quiver

  2. #2
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    141
    It's possible, but you must check if it performs good. Just break the column into pieces. If you have allways the same pattern (fname.lname) you could do something like:

    SELECT SUBSTR(your_column, 1, LOCATE('.', your_column)-1) AS fname
    ,SUBSTR(your_column, LOCATE('.', your_column)+1) AS lname
    FROM your_table
    ORDER BY 1
    or
    ORDER BY 2

    HTH
    Rodney Krick

  3. #3
    Join Date
    May 2004
    Posts
    2
    Quote Originally Posted by RKrick
    It's possible, but you must check if it performs good. Just break the column into pieces. If you have allways the same pattern (fname.lname) you could do something like:

    SELECT SUBSTR(your_column, 1, LOCATE('.', your_column)-1) AS fname
    ,SUBSTR(your_column, LOCATE('.', your_column)+1) AS lname
    FROM your_table
    ORDER BY 1
    or
    ORDER BY 2

    HTH
    Thanks a lot....it worked out perfectly
    regards
    quiver

Posting Permissions

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