www.webdeveloper.com
Results 1 to 4 of 4

Thread: Exact match

  1. #1
    Join Date
    Dec 2006
    Posts
    24

    Question Exact match

    Hi,

    I am trying create a simple "Select" for exact match. I am trying:

    '%" & strKeyword & "%' - Find all matches! Donīt work for me!

    '%" strKeyword "%'

    '" & strKeyword & "'

    '" strKeyword "'

    'strKeyword'

    All above examples not works for find exact matches!

    Could you help me?

    Thanks

    Lebron

  2. #2
    Join Date
    Jun 2005
    Location
    Winston-Salem, NC
    Posts
    318
    Your select statement should look something like this.

    "SELECT * FROM YourTable WHERE YourField LIKE '%" & strKeyword & "%'"

  3. #3
    Join Date
    Dec 2006
    Posts
    24
    No. In this way It find all words that contains, for example "the", such as "whether".

    From other hand if I use
    "SELECT * FROM YourTable WHERE YourField = '%" & strKeyword & "%'"

    it display nothing!

    Thanks

    lebron

  4. #4
    Join Date
    Jun 2005
    Location
    Winston-Salem, NC
    Posts
    318
    I don't think you can use the = sign and wildcards together. However you could try this.

    SELECT * FROM YourTable WHERE YourField LIKE '% " & strKeyword & " %'"

    This I believe would keep you from finding "whether". However the down side of this is that if your data has anything but spaces before or after your keyword than it won't return that record (i.e. the,).

    Here's another post where me and some other people discussed a similar problem.
    http://www.webdeveloper.com/forum/sh...d.php?t=152839

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles