Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: SQL Server
Expertise: Beginner
Jul 16, 1999



Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

Designing a keyord search query in Access

I'm still quite new to using SQL and I am designing a database in which I am cataloging resources owned by my company. I am attempting to create a query that will allow the user to enter a value such as an author's name and have the query search the author's field to provide all records with that author's name. My problem is that when I set a parameter and run the query, the prompt shows up and requests that the user enter the parameter. This part is fine, however, it only works if the parameter value is exactly what was entered by the user. For example if the Authors name is John Smith, but at the prompt the user enters only Smith, no records appear. I am designing in Access.

It sounds to me like you need the LIKE comparison operator with a "%" (percent sign) on both sides of the thing you want to test like this:

SELECT framis
FROM foobar
WHERE foobar.framis LIKE %SMITH% 
This will retrieve Smithson, Winesmith and Smith.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date