I’m building a website where you add items with multiple categories.
what is the best way to store multiple categories in one field and still keep the field searchable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t store multiple categories in one field, you create a separate table to assign categories to each item. Similar to this:
Then you will query the data by joining the tables:
See SQL Fiddle With Demo