Explore BrainMass

SQL pattern matching with MS Access

This content was COPIED from BrainMass.com - View the original, and get the already-completed 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 March 21, 2019, 2:46 pm ad1c9bdddf


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.