1. Like Operator

          Compares a string expression to a pattern in an SQL expression.

          Syntax

          expression Likepattern

          The Like operator syntax has these parts:

          Part

          Description

          expression

          SQL expression used in a WHERE clause .

          pattern

          String or character string literal against which expression is compared.


          Remarks

          You can use the Like operator to find values in a field that match the pattern you specify. For pattern, you can specify the complete value (for example, Like “Smith”), or you can use wildcard characters to find a range of values (for example, Like “Sm*”).

          In an expression, you can use the Like operator to compare a field value to a string expression. For example, if you enter Like “C*” in an SQL query, the query returns all field values beginning with the letter C. In a parameter query, you can prompt the user for a pattern to search for.

          The following example returns data that begins with the letter P followed by any letter between A and F and three digits:

          Like “P[A-F]###”

          The following table shows how you can use Like to test expressions for different patterns.


          Kind of match


          Pattern

          Match
          (returns True)

          No match
          (returns False)

          Multiple characters

          a*a

          aa, aBa, aBBBa

          aBC

          *ab*

          abc, AABB, Xab

          aZb, bac

          Special character

          a[*]a

          a*a

          aaa

          Multiple characters

          ab*

          abcdefg, abc

          cab, aab

          Single character

          a?a

          aaa, a3a, aBa

          aBBBa

          Single digit

          a#a

          a0a, a1a, a2a

          aaa, a10a

          Range of characters

          [a-z]

          f, p, j

          2, &

          Outside a range

          [!a-z]

          9, &, %

          b, a

          Not a digit

          [!0-9]

          A, a, &, ~

          0, 1, 9

          Combined

          a[!b-m]#

          An9, az0, a99

          abc, aj0



          Expand your Office skills
          Explore training
          Get new features first
          Join Office Insiders

          Was this information helpful?

          Thank you for your feedback!

          Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

          ×
            1. http://www.mh8dociw.tw | http://m.mh8dociw.tw | http://wap.mh8dociw.tw | http://3g.mh8dociw.tw | http://4g.mh8dociw.tw | http://5g.mh8dociw.tw | http://mobile.mh8dociw.tw | http://vip.mh8dociw.tw | http://ios.mh8dociw.tw | http://anzhuo.mh8dociw.tw | http://67d8.mh8dociw.tw | http://b405.mh8dociw.tw | http://296e.mh8dociw.tw | http://9119.mh8dociw.tw | http://04fc.mh8dociw.tw | http://000.mh8dociw.tw | 香蕉在线蕉久在线