1

I want to select a row from my table where the "user id" is equal to some userid, but my columns are an array. How can I select on it?

Image of MySQL Page

3
  • for array which language you use here ? Commented May 4, 2019 at 6:24
  • Try FIND_IN_SET dev.mysql.com/doc/refman/8.0/en/… Commented May 4, 2019 at 6:27
  • MySQL has no type called "array" so I don't understand the question. I do see strings with commas which is usually an indicator that the data model needs to be fixed. Commented May 4, 2019 at 11:24

4 Answers 4

3
select * from table_name where FIND_IN_SET(@user_id,user_id) > 0
Sign up to request clarification or add additional context in comments.

Comments

0

are you expecting something like this

select * from table_name where userid=@userid

1 Comment

i have array in column and i want to select from column but i cant select from array in sql
0

Try this Query..

select * from table where CONCAT(',', userid, ',') like '%,@yourid,%'

Comments

0

Try this mysql

select * from table_name where FIND_IN_SET('%@userid%',userid);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.