Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keywords in queries

Status
Not open for further replies.

TechnicalScott

Technical User
Jan 26, 2005
71
GB
Hi all,

How do I make it so that my query can handle keywords ?
Eg - I have a field which contains - "paris, london". How do i get the query to pickup either one of those words from my input so that i can report on it?

Kindest Regards

Scott
 
Experiment with the LIKE operator:

SELECT * FROM tableNameHere WHERE fieldNameHere LIKE '*paris*';

SELECT * FROM tableNameHere WHERE fieldNameHere LIKE '*london*';

SELECT * FROM tableNameHere WHERE fieldNameHere LIKE '*paris*' OR fieldNameHere LIKE '*london*';


[pc2]
 

Pick up sounds like... prompting?
Maybe a parameter query!

PARAMETERS [Enter city:] Text(255);
SELECT *
FROM tableNameHere
WHERE fieldNameHere LIKE [Enter city:] & '*';
 
Or to follow on from Jerry's post, to allow for the city name searched for not necessarily being at the start of the field...
Code:
PARAMETERS [Enter city:] Text(255);
SELECT * 
FROM tableNameHere 
WHERE fieldNameHere LIKE '*' & [Enter city:] & '*' ;

[pc2]
 
prompting is right, is there a way to put a command in one of the query criteria boxes ?

Thank you for your help
 

Copy paste into the SQL View of a new query.
If you need extra criteria for the query, apply them accordingly after switching to design view.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top