[posted and mailed]
SkunkDave (da***********@totalise.co.uk) writes:
Having this description column in a table
"Cookies, peanut butter sandwich, regular"
When using this WHERE clause:
WHERE (((Food_Data.Description) Like "*Butter*" & "*Peanut*"));
I dont get any results, however when using it this way round
WHERE (((Food_Data.Description) Like "*Peanut*" & "*Butter*"));
I get the row as expected.
I assume that the query looks for them in order.
The query looks for a string that matches the pattern "*Peanut**Butter*",
so obviously it's not going to match "Butter Peanut".
As suggested by Harald Albrech this works:
WHERE (Food_Data.Description Like "*Butter*" or
Food_Data..Description Like "*Peanut*");
Note that the newsgroup you posted is devoted to MS SQL Server, and
the syntax you posted is not legal in SQL Server, but it looks that
it could be Access. Access has its own newsgroup, I believe the name is
comp.databases.ms-access. You may want to post there next time you
have a problem.
--
Erland Sommarskog, SQL Server MVP,
so****@algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp