MySQL query get column value similar to given -


Sorry if my question seems unclear, then I will try to explain.
I have a line in a row, for example / 1/3/5/8/42/239/ , suppose I would like to find a similar place Where equally "id" is possible

example:

  | My column | # 1 | 1/3/7/2/4 / | # 2 | 1/5/7/2/4 / | # 3 | 1/3/6/8/4 / |  

Now, by running a query on # 1 , I want to get the line # 2 because it's the most common to do something like this Is it the way or is it just my imagination? Thanks for your time.

EDIT:
Have suggested that I am expanding my question. This column represents a user's favorite artist from a music site. I'm searching for them like ' MyColumn like'% / id /% ' and by removing / id / with /

Let me delete

Since you have not really given much information about your data, I have to fill the gap with my estimates.

then you have user table

  user table ----------- ID name other_stuff  

And if you want the artist who is a user's favorite then you should have an artist table

  artist table ------------- ID name other_stoff  

and you can add another table named Related Favorites

  Favorites table --------------- user_id artist_id  

In that table, Add a record that a user likes

Example data

  User ID | Name 1 Tom 2 | John Artists ID | Name 1 Michael Jackson 2 | Madonna 3 | Dark purple favorite user_id | Artist_id1 1 1 | 3 2 2  

For example, you can do a

  one by the artists. Choose Name Add to Favorites F.artist_id = a.id and add user user to f.user_id = u.id where u.name = 'tom'  

and if If you add proper indexing to your table then it's really fast!


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -