Manixat Posted April 3, 2013 Share Posted April 3, 2013 Hello freaks, I'm looking for a way to select multiple IDs from a table based on a string of those IDs separated by a comma. The string in question is a record from another table. Now I can easily retrieve the string and perform various operations to assemble a new query, but it couldn't bother me more that there most probably is a correct way of doing this using only mysql. So I turn to you - is there such way? Quote Link to comment https://forums.phpfreaks.com/topic/276482-selecting-multiple-ids-from-a-string/ Share on other sites More sharing options...
Solution Barand Posted April 3, 2013 Solution Share Posted April 3, 2013 Never store ids in comma separated lists. Normalize the data. Quote Link to comment https://forums.phpfreaks.com/topic/276482-selecting-multiple-ids-from-a-string/#findComment-1422660 Share on other sites More sharing options...
Manixat Posted April 3, 2013 Author Share Posted April 3, 2013 (edited) Do you by normalize mean that I should create another table and relate them :/My apologies, I'm a self learner and that is what I just read about data normalization Edited April 3, 2013 by Manixat Quote Link to comment https://forums.phpfreaks.com/topic/276482-selecting-multiple-ids-from-a-string/#findComment-1422667 Share on other sites More sharing options...
Psycho Posted April 3, 2013 Share Posted April 3, 2013 Do you by normalize mean that I should create another table and relate them :/ Yes. Quote Link to comment https://forums.phpfreaks.com/topic/276482-selecting-multiple-ids-from-a-string/#findComment-1422668 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.