Jump to content

Recommended Posts

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.

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 by ChrisC123
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.