By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,149 Members | 885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,149 IT Pros & Developers. It's quick & easy.

Searching a field with comma separated string...

P: 1
.. Hi peeps. I have search for guidance but google isnt doing its job like it used to and would like to reach out to yall for help.

My problem is below and i am doing this in access 2007.

I have a table Hobbies:


Records for example, would be like:

|James Ross||London||12/12/85||cricket, snooker, electornics, building||
|David Magambo||Manchester||01/09/87||gaming, biking, poker||
|Hans Gruber||Berlin||01/01/73||smoking, programming, gaming, tennis||

I want to be able to search the comma separated string for words. for example if i were to search for the people with the keywords "gaming" it would bring up David and Hans recrods, or if i were to search for keywords "cricket" or "tennis" it would bring up James and Hans records..

Im guessing it would be an sql query? and it might be trivial but i have no idea how to go about this and would really appreciate the help.

Thank, Jimmy.
Feb 2 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,072
Correct, you need the "LIKE" comparison with the "*" wold character in the WHERE clause like:
Expand|Select|Wrap|Line Numbers
  1. select * from tblHobbies where keywords like '*tennis*'
Feb 2 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.