ChrisC123 Posted February 16, 2013 Share Posted February 16, 2013 Hello all. I am fairly new to php/mysql and have been using it daily for about two months now. I was wondering what alternatives I could use to replace multiple columns that all hold similar data? I am big on searching for solutions, I am just having a hard time figuring out what it is I need to search for. Right now I have a table called 'user' with three simular columns called: pri_device_id sec_device_id alt_device_id They all can either be null or have an INT(11) from table 'devices', column 'device_id'. I have been using simple query selects and if else functions up to this point. The problem is that there are rare situations when there might be more than three assigned devices per user (or none and all) and it just seems like there would be a better way to do this with only one columnsomehow holding multiple ids. Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2013 Share Posted February 16, 2013 Google "data normalization" Quote Link to comment Share on other sites More sharing options...
ChrisC123 Posted February 17, 2013 Author Share Posted February 17, 2013 (edited) Yep. Got it. Thanks! I had already done a good amount of reading on normalization and refined my db structure once from that reading. After your suggestion one search I did was for “data normalization multiple int one column” which did have some interesting info on making that work. After an hour or so of reading I ended up coming to the conclusion that I was doing it all wrong in the first place and once again made changes to my db structure removing the need for my original question and trying to adhere more closely to the normal form. Thanks again. Edited February 17, 2013 by ChrisC123 Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 17, 2013 Share Posted February 17, 2013 Good job. Quote Link to comment 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.