SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Using Wildcard

  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using Wildcard

    Thanks for helping me

    If I use where...
    ... like '%table%'" will return anything that has 'table' is the string.

    however, if i have two strings, one contains "...table...", another contains "...comfortable...", then both of these strings will be selected.

    If I just want to select the one of "table" but not "comfortable",
    Can anyone teach me how to do?

    Thanks

  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what you want.
    You want to pull out any string with "table" in it, but when it does what you ask for, you don't want that?

    So what is it you're looking for then?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  3. #3
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try '% table %', but you would also need to back that up just in case it appears at the end of a line with '% table.%'.

    Edit:

    also '% table,%'
    Lats...

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,250
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    using LIKE for this is just too messy, there are just too many variations that you have to cater to (all the various punctuation marks)

    try this instead --

    ... where columname regexp '[[:]]table[[:>:]]'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all your help. I appreciate it.


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
  •