Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2002
    Posts
    32

    Question Unanswered: Query using LIKE

    What is the query syntax for finding a word/string within a longer word/string?

    For example, if the above question was the value of FIELD1 in TABLE1 of DATABASE1, what would the query look like if I wanted to search by the word "syntax" and have the results return FIELD1 as a match?

    Thanks!

    Timm

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    is this a trick question? wouldn't ordinary LIKE syntax do it?

    select FIELD1 from TABLE1
    where FIELD1 like '%syntax%'

    rudy

  3. #3
    Join Date
    Oct 2002
    Posts
    32
    I wasn't sure. I saw a LIKE statement, but then I also saw things like

    .... Where MATCH (FIELD1) Against (STRING) ...
    and something about specifying a full text search key. Do I need to do those things, too?

    If I use the ...Where FIELD1 like '%syntax%' ... does it matter how many characters are in the field I am searching?

    Again, thanks!

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    LIKE should suffice

    i know in oracle you cannot search a LONG datatype with LIKE, but there appears to be no such restriction in mysql

    MATCH (which i've never used) returns relevancy -- check 6.3.2.1 String Comparison Functions

    rudy

  5. #5
    Join Date
    Oct 2002
    Posts
    32
    Thanks, Rudy!

    Tim

Posting Permissions

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