Matching with LIKE command and wildcards

  • I am trying to match two tables - 1 with a

    field that has 8 char and the other has 8 char but will have blanks in some char that are not significant. I created a new field that put _ in the blank and then tried to match but the _ did not work as a wildcard.

  • Rocko,

    Try this and see if it works or helps..

    CREATE TABLE TestPerson (

    PLogin VARCHAR(10),

    PName VARCHAR(30)

    )

    CREATE TABLE MatchMask (

    FindValue VARCHAR(10)

    )

    INSERT INTO TestPerson VALUES

    ( 'Login1', 'First test login' )

    INSERT INTO TestPerson VALUES

    ( 'Login100', 'Hundredth test' )

    INSERT INTO MatchMask VALUES ( 'Login_' )

    SELECT * FROM TestPerson

    WHERE PLogin LIKE ( SELECT FindValue FROM MatchMask )

    Hope this helps

    Guarddata-

  • Oops - Of course if you are looking for a JOIN command, you could do this:

    SELECT P.* FROM TestPerson P

    INNER JOIN MatchMask M ON P.PLogin LIKE M.FindValue

    Guarddata-

  • quote:


    Oops - Of course if you are looking for a JOIN command, you could do this:

    SELECT P.* FROM TestPerson P

    INNER JOIN MatchMask M ON P.PLogin LIKE M.FindValue

    Guarddata-


    Thanks for your help Guarddata !

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply