SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: sql and LIKE

  1. #1
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Milky way
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sql and LIKE

    Hi

    I have a question about the LIKE statement.

    I have names in the database like: roses_1, roses_2, stuff_1, stuff_2...stuff_11...

    All I want to get is roses_1 and stuff_1, nothing more.
    and If I do sql:
    select name from table where name like'%_1'

    and I get like this: roses_1, roses_11, stuff_11...

    but As I read the '_' is also some kind of wildcard that replaces any of the word? Is there any other symbol that represents the '_' character for the actually string stored in the database?



    Thanks

    Zinko

  2. #2
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    698
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Code:
    select name from table where name like'%|_1' escape '|'


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
  •