Explore BrainMass

SQL pattern matching with MS Access

This content was STOLEN from BrainMass.com - View the original, and get the solution, here!

Why wont this query give me any results?

SELECT author_name
FROM authors
WHERE author_name = "*Twain, Mark*";

After all, the text string

Twain, Mark

does exist in the author_name table.... (try it out using the database "WEEK1_Q1_Q2_ACCESS2000.mdb" attached here.

© BrainMass Inc. brainmass.com September 24, 2018, 10:15 am ad1c9bdddf - https://brainmass.com/computer-science/pattern-matching/sql-pattern-matching-ms-access-132318


Solution Preview

This query is a valid query but it's probably not doing what you expect. When searching on text fields there are two ways to search the text. One is an "exact match" and the other is a "pattern match". Using the "=" symbol tells Access to perform an exact match. Using ...

Solution Summary

This solution shows how to do pattern matching in a MS Access SQL query. It explains the difference between an exact match and pattern match string comparison.