SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict ruba's Avatar
    Join Date
    Apr 2005
    Location
    Amman -Jordan
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question what is the diff. b/w match and like

    hi all,
    I try to write this query
    Code:
    SELECT SQL_CALC_FOUND_ROWS Ch.id as id, Ch.name_arabic as ChName, Ch.logo as pic , Lang.name_arabic as Lang , Class.name_arabic as Class, Grp.grpname_arabic as 'Group', Owner.ownername_arabic as Owner FROM channels AS Ch , classifications AS Class , languages AS Lang , ownership AS Owner , groups AS Grp WHERE (Lang.id = Ch.language_id) AND (Class.id = Ch.classification_id) AND (Owner.id = Ch.ownership_id) AND (Grp.id = Ch.group_id) AND (MATCH (Ch.name_arabic) AGAINST ('%2M%')) ORDER BY Ch.id LIMIT 0,5
    it's not working , but when write it using like
    Code:
    SELECT SQL_CALC_FOUND_ROWS Ch.id as id, Ch.name_arabic as ChName, Ch.logo as pic , Lang.name_arabic as Lang , Class.name_arabic as Class, Grp.grpname_arabic as 'Group', Owner.ownername_arabic as Owner FROM channels AS Ch , classifications AS Class , languages AS Lang , ownership AS Owner , groups AS Grp WHERE (Lang.id = Ch.language_id) AND (Class.id = Ch.classification_id) AND (Owner.id = Ch.ownership_id) AND (Grp.id = Ch.group_id) AND (Ch.name_arabic like '%2M%') ORDER BY Ch.id LIMIT 0,5
    every thing goes ok , and there is data,
    I don't know the reson, where my table collection is "cp1256_general_ci"

    what is the problem ??
    Open Blocked website
    Open Blocked Website
    Knowledge Is Knowing That A Tomato Is A Fruit,
    Wisdom Is Not Putting It In A Fruit Salad.

  2. #2
    SitePoint Guru MikeBigg's Avatar
    Join Date
    Jun 2004
    Location
    Reading, UK
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nm
    Last edited by MikeBigg; Jul 4, 2007 at 05:25.

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,246
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    MATCH is fulltext, and you have a wide range of logic options

    explained in the fine manual here: Full-Text Search Functions

    LIKE is string function, limited functionality but relatively efficient, very often all you really need

    explained in the fine manual here: String Comparison Functions

    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
  •