Re: multiple fields all unique?
| From: | John W. Holmes | Date: | Thu, 05 Feb 2004 01:33:36 +0000 |
| Subject: | Re: multiple fields all unique? | ||
| References: | 1 2 3 4 5 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32777@lists.php.net to get a copy of this message | ||
Jas wrote:
John W. Holmes wrote:alter hosts add unique(mac); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.comFrom: "Jason Gerfen" <jason.gerfen@scl.utah.edu>Yes definately, I am trying to convert my exisiting fields to a unique type and am having no luck what-so-ever. This is the table format: +----------+--------------+------+-----+---------+----------------+Yeah, I have never used a unique field for the database, and you are right it is a mysql db.Now is a good time to do it the right way, then...| Field | Type | Null | Key | Default | Extra |+----------+--------------+------+-----+---------+----------------+| id | int(11) | | PRI | NULL | auto_increment | | hostname | varchar(100) | | | | | | mac | varchar(100) | | | | | | ip | varchar(100) | | | | | | vlan | varchar(100) | | | | |+----------+--------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec) and this is the command I am tying to run to modify the hostname, mac & ip fields to unique. alter hosts add unique mac;