Is it possible to use MySQL's SUBSTRING() function in a WHERE clause?

Discussion in 'Programming' started by archard, Jun 21, 2008.

  1. #1
    To my surprise my queries return no results when I try to do this, and I can't find any information on whether or not SUBSTRING() can be used in the WHERE clause. I simply want to return results only where the first letter of the value of a column matches a certain letter. Maybe there's a more proper way to do it?
     
    archard, Jun 21, 2008 IP
  2. rile

    rile Member

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    Try something like this:

    SELECT * FROM table WHERE field LIKE 'aa%';
     
    rile, Jun 21, 2008 IP