so actually i’m writing client/server programs using TCP/IP. In this case, client can upload file and choose whether the file is shared to public,group,or private. The problem is when the client choose to share the file to group(other clients/members). As a beginner, i have no idea to store a string array which is contains the name of the selected members into SQL database. So, i decided it to create a long string like the example below.
//assume this is the long string stored in column called "member"
//this is row1// "Lexus,Mitsubishi,Bmw,Audi,Ford"
//this is row2// "12345678,456789,54321,87654321,Lexus"
then i want to check whether “Lexus” is in those strings above. If it exists, then i will show those two rows.
So the main point is, i really want to know how to write the SQL Query in this case, and perhaps you have the best way to solve this problem.
Thank you for helping me, currently it’s working with ‘LIKE’ operator.
SELECT * FROM TABLENAME WHERE ROW1 LIKE '%LEXUS%'
but i think the problem is not solved yet even though it is working, because i’m still using a single long string. I agree with Tim’s suggestion that i need to create another table, but i think i need more tutorials about connecting two tables using primary key and foreign key
Have you tried using the
LIKEoperator?SELECT * FROM TABLENAME WHERE ROW1 LIKE '%LEXUS%'