dbutler Posted July 14, 2009 Share Posted July 14, 2009 I'm creating a database with two tables. the first table is a "user" table where I store registered users information. this table uses userid as a primary key such that each user exists only once. The second table is a table of general ledger id's (5 digit id's that represent accounting profit/loss centers). Now for the tricky part; an individual user could have just one or even 100 general ledger id's that they are capable of viewing. How do I set up the user table to account for "N" number of general ledger id's per user? Do I create 100's of columns in the user table to account for each general ledger id or is there a more creative way to handle this? Your help appreciated!!!! drb Link to comment Share on other sites More sharing options...
justsomeguy Posted July 14, 2009 Share Posted July 14, 2009 Add another table that has a user ID column and a ledger ID column, and add a record for each user/ledger combo. Link to comment Share on other sites More sharing options...
tal Posted July 30, 2009 Share Posted July 30, 2009 have you tried working with SET as the column typeif i get your question right this is just right for youTal Link to comment Share on other sites More sharing options...
es131245 Posted August 6, 2009 Share Posted August 6, 2009 How can i edit my table???For example ive created a table...id auto increment, user,email,passcan i chage it toid auto increment unique, user unique,email,passi dont want to export data to a new table Link to comment Share on other sites More sharing options...
justsomeguy Posted August 6, 2009 Share Posted August 6, 2009 If the ID column is the primary key then it's also unique. If you want to make the user field unique then you can add a unique index on that field. Link to comment Share on other sites More sharing options...
es131245 Posted August 11, 2009 Share Posted August 11, 2009 any way i still need to know how to edit tables.... Link to comment Share on other sites More sharing options...
justsomeguy Posted August 11, 2009 Share Posted August 11, 2009 The ALTER TABLE statement changes tables, or you can use a GUI like phpMyAdmin. Link to comment Share on other sites More sharing options...
es131245 Posted August 15, 2009 Share Posted August 15, 2009 can i start table with id = 0????CREATE TABLE `users` (`id` int(25) auto_increment,`Created` varchar(25) NOT NULL,`login` varchar(25) NOT NULL,`psw` varchar(25) NOT NULL,`email` varchar(25) NOT NULL,`nick` varchar(25) NOT NULL,PRIMARY KEY (id)) ENGINE=MyISAM DEFAULT CHARSET=latin1when i INSERT it starts with 1 if i UPDATE it to 0 table still carry ons from 2....any way???? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 17, 2009 Share Posted August 17, 2009 I don't know why you would need to change the auto increment value, but you can use ALTER TABLE to do that also.http://dev.mysql.com/doc/refman/5.0/en/exa...-increment.html Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.