farzher Posted February 7, 2011 Share Posted February 7, 2011 So, I want to be able to do this: "WHERE something IN(SELECT array FROM table WHERE id='$id')" So that I can select the array of strings and use the IN function on it. Is this possible? Right now I have to select the CSV array of strings ex: "one,two,three" and format it like this "'one','two','three'" using php then do a second select passing that sting into the IN function. What kind of format would I need to use to get this to work in one query with mysql? Quote Link to comment https://forums.phpfreaks.com/topic/226926-storing-an-array-of-strings-in-mysql-and-using-the-in-function-on-it/ Share on other sites More sharing options...
JonnoTheDev Posted February 7, 2011 Share Posted February 7, 2011 Yes this is possible if you cannot do it with regular joins. ie SELECT name FROM users WHERE id IN(SELECT id FROM logins) Quote Link to comment https://forums.phpfreaks.com/topic/226926-storing-an-array-of-strings-in-mysql-and-using-the-in-function-on-it/#findComment-1170932 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.