Results 1 to 4 of 4

Thread: Simple Question

  1. #1
    Join Date
    May 2004
    Posts
    28

    Unanswered: Simple Question

    This is a simple question and I have looked around for the answer but have not been able to find it. How do I return the first character of a string in MySQL. For example the following code returns the firstname of students in a database:

    SELECT (first_name) FROM chc_students;

    How do I modify that query to return only the first letter of the firstname?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd use the Left() function.

    -PatP

  3. #3
    Join Date
    Jun 2004
    Posts
    3
    Use:
    select left("string",1);

    returns:
    s

  4. #4
    Join Date
    May 2004
    Posts
    28
    Thanks, that worked

Posting Permissions

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