Results 1 to 4 of 4

Thread: displaying part of a field

  1. #1
    Join Date
    Jun 2003
    Posts
    1

    Angry displaying part of a field

    im new to all this.

    what i wanted to do was seach through a database and extract just the first letter from both a field firstname and lastname from table customers.

    so i get JD from John , Doe

    i got the search okey too look up the names but how do i display them in "JD" just the initials on a new column?

    any help would be great.
    Thank you in advance

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    select fname,lname,left(fname,1)+left(lname,1) as Newinitial from tablename

  3. #3
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    OOPS. I forgot it is MYSQL.
    here you go

    SELECT fname,lname,CONCAT(left(lname,1),left(lname,1)) from test1;

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    SELECT fname,lname,CONCAT(left(fname,1),left(lname,1)) from test1;

Posting Permissions

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