Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8483145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:00:46+00:00 2026-06-10T20:00:46+00:00

I have field called features as i am storing the value as comma separated

  • 0

I have field called features as i am storing the value as comma separated values, now while selecting i need to fetch the corresponding name of the comma separated vale

table1- feature

id    feature_names
1        A
2        B
3        C
4        D
5        E

table2- car

id   car    feature_ids

1    Zen    2,3,4   // features = B,C,D
2    Benz   1,2     // features = A,B
3    Audi   4,5     // features  = D,E

How to get the corresponding names of the comma separated values while selecting the car table?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:00:48+00:00Added an answer on June 10, 2026 at 8:00 pm

    Redesign your database.

    • feature – id, name
    • car – id, name
    • car_feature – car_id, feature_id

    After that, you can use a JOIN in your query. Something like this:

    SELECT car.*, feature.name FROM car
        JOIN car_feature ON car_feature.car_id = car.id
        JOIN feature ON feature.id = car_feature.feature_id
    

    You should not use comma-separated fields like that in relational databases. Certainly not, if you want to write queries based on that field. Even if it seems to work, it will quickly become extremely inefficient and unmaintainable.

    Your scenario is called a Many-to-many relationship between the tables – cars can have any features and a feature can belong to any cars. The technique I outlined is called Cross-reference table. I have given all the keywords for you to search for the right MySQL tutorials and articles, for example:

    • How to handle a Many-to-Many relationship with PHP and MySQL
    • MYSQL: Many To Many Relationships
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a field called CreatedOn with values like : 2012-06-19 08:42:48.000 2012-06-19 08:43:05.000
I have a field called submit_date which stores the value of a timestamp. The
I have a field called system in my database which looks like this system
Hi i am doing internal mail service application , i have the field called
I have a custom field called HourField, which lets you enter 1:30 to represent
I have a table called products containing a field called price and I simply
I have a struct that has a field called type How do i access
I have a table which has a field called Sold , in that field
I have an ActiveRecord model with a field called name (in the database) and
I have a class User with one field called birthDate which is a java.sql.Date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.