Problem on SELECT statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kwok
    New Member
    • Jun 2006
    • 12

    #1

    Problem on SELECT statement

    I searched a statement in google which is very common

    e.g. data
    Name ID
    Carmen 123
    David 456
    Daisy 789
    John 431
    Leon 670
    Simon 553

    SELECT ID FROM data WHERE Name LIKE 'D%';

    This is a very very common code where SELECT...FROM.. ..WHERE.....LIK E.....

    This will search all the data from data which begin with d
    which result is 456 and 789

    However I don't know why this function cannot work in my access2000 environment.... ..

    It always can't search the string with % at the end

    Which
    SELECT ID FROM data WHICH Name LIKE 'DAVID';
    result return is david
    SELECT ID FROM data WHICH Name LIKE 'DAVI?';
    result is david too....
    However
    SELECT ID FROM data WHICH Name LIKE 'DAVI%';
    Result is nothing.....

    HELP
    My company need me finish this project in one week and the deadline is coming......
  • Egypt_81
    New Member
    • Jul 2006
    • 25

    #2
    hi
    In access u use * instead of %
    so your query must be
    SELECT ID FROM data WHERE Name LIKE 'D*';

    I wish u finish before ur dead line, tell me if u need anyhelp
    Best wishes
    Hesham el ebrashy

    Comment

    • xpcer
      New Member
      • Jul 2006
      • 51

      #3
      that's right, in access u must use * not %.
      if u use _ in mssql, u must use ?

      for example :

      in mssql :
      SELECT ID FROM data WHERE Name LIKE 'D_VID';

      in acces:

      SELECT ID FROM data WHERE Name LIKE 'D?VID';

      Comment

      • sylvie36
        New Member
        • Jul 2006
        • 4

        #4
        Hello,

        You can try that :

        SELECT ID FROM data WHICH Name LIKE 'DAVI*';

        It's the solutions I find in a the next site :
        http://www.fgcu.edu/support/office2000/access/queries.html

        bye

        Sylvie


        Originally posted by Kwok
        I searched a statement in google which is very common

        e.g. data
        Name ID
        Carmen 123
        David 456
        Daisy 789
        John 431
        Leon 670
        Simon 553

        SELECT ID FROM data WHERE Name LIKE 'D%';

        This is a very very common code where SELECT...FROM.. ..WHERE.....LIK E.....

        This will search all the data from data which begin with d
        which result is 456 and 789

        However I don't know why this function cannot work in my access2000 environment.... ..

        It always can't search the string with % at the end

        Which
        SELECT ID FROM data WHICH Name LIKE 'DAVID';
        result return is david
        SELECT ID FROM data WHICH Name LIKE 'DAVI?';
        result is david too....
        However
        SELECT ID FROM data WHICH Name LIKE 'DAVI%';
        Result is nothing.....

        HELP
        My company need me finish this project in one week and the deadline is coming......

        Comment

        Working...