How to fetch the result using in array

how to get the result viewers_id =admin1002

i write the query:
select * from file_sharing where viewers_id in(‘admin1002’)

but i got empty result.

kindly send me anyone runable code

There appears to be no such entry in the table. The mistake you are making is storing more than one value in a single column, this practice is flawed, as you are finding.
The answer is use associated tables to store this data. An additional look-up table may be enough in this case.

1 Like

i want to echo SamA74’s answer – you are violating First Normal Form

while you are thinking about the redesign of your table, you can run this –

 WHERE FIND_IN_SET('admin1002',viewers_id) > 0

except this works only in MySQL

i should caution you that it also requires a table scan, eh

1 Like

r937 thank you it’s working fine

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.