How to use the SQL Like / ALike operator
You can use the SQL Like / ALike operator to find values in a field that match the pattern you specify. The power of Like / ALike is that it alows you to use wildcard characters to find a range of values. For details on the difference between Like and ALike read the Notes
SELECT * FROM Products WHERE Products.ProductName ALike 'Chef%';
The patterns that you can choose from are:
%: any string of any length (including zero length - percent sign wildcard ) _: a single character (underscore wildcard)
You can use multiple wildcards in your Like pattern, e.g. ALike '%Chef%'
will also return records with text before 'Chef'.
If you want all records expect the ones with 'Chef' use the Not operator: Not ALike '%Chef%'
Notes |
---|
|
Warning |
---|
From Access 2010 onwards, the sql editor will automatically change the keyword Like to ALike, but does not change the wildcards accordingly, which will make the query no longer work correctly, |