Unanswered: Different Usage of LIKE in SQL Sentences
Imagine that I have two rows of records on an MS Access database like this:
Row 0: "Human being is mortal"
Row 1: "Human being is immortal"
I want to list the records which contains exactly "mortal". How can I do this?
"SELECT * FROM MyTable WHERE MyColumn LIKE 'mortal'" returns 0 row.
"SELECT * FROM MyTable WHERE MyColumn LIKE '%mortal%'" returns 2 rows, including "mortal" and "immortal". But I want to list the records which contains exactly "mortal".
That is pretty neat and it works as well, which always helps
It is interesting in that often what you learn or have to learn in Access is often determined by stuff you already have done. For example, in my case i have "name" and "suburb" entered in a single field as in
William J Kennedy
Hurstville NSW 2209
for ease of entry. As a result I have lots of queries with several right trims running in series to get such data into individual fields and as such "* mortal" etc has never been an issue for me.
The closest you can get is '% mortal%" unless you want to get significantly more involved. Depends on how pissed off you would be if you returned something with "mortal" as a prefix. If it's bearable, then stick with that. Otherwise you have a considerable amount of parsing to do.