SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    5
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    select character

    Hi,

    If I want to use a query to do matching for second character in a column, how should I go about to get this done?

    E.g : I want so search which records has 8 as second character of the entry in a table.

    e.g :
    1234
    1281
    1881
    2899

    Then it will show the results for 1881 and 2899 since both has the character in the second position.

    I tried to use substr function but it is not working. Please advise and thanks.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,262
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Ronan View Post
    I tried to use substr function but it is not working.
    that's because there is no SUBSTR function in mysql, only a SUBSTRING function

    and yes, it does work
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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