Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to split and sort name field

Ara_camAra_cam Member Posts: 37
I have a table with a Customer_Name field that holds data like:
Dr. John L. Jones
Dr. James Doe
Dr. Jane Dee Long

I need to sort this data by last name, first name. some rows have a middle name, some have middle initial, and some have no middle at all. All have the Dr. at the beginning.

Any ideas how to do this using SQL?



Comments

  • MrEdMrEd Member Posts: 180
    : I have a table with a Customer_Name field that holds data like:
    : Dr. John L. Jones
    : Dr. James Doe
    : Dr. Jane Dee Long
    :
    : I need to sort this data by last name, first name. some rows have a middle name, some have middle initial, and some have no middle at all. All have the Dr. at the beginning.
    :
    : Any ideas how to do this using SQL?
    :

    Without resorting to PL/SQL, you could do it with a bunch of built-in string manipulation functions like substr, ltrim, length, initcap, instr.
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _ \ http://forcoder.org \ free ebooks and video tutorials about | C++ Delphi JavaScript C Swift Java MATLAB Objective-C Visual Basic .NET C# Perl Go Assembly PL/SQL Ruby PHP Python Visual Basic R Scratch Fortran LabVIEW D Erlang Scala Awk ML Kotlin Logo FoxPro Bash Scheme Julia Alice F# Dart Apex SAS VBScript Lisp COBOL Transact-SQL Ada Crystal Lua Clojure Rust ABAP Hack Prolog | _____

Sign In or Register to comment.