I am not sure about the primary key.
You can create a UNIQUE index on (field1, field2, field3, field4)...
(I have done this)
This will prevent any duplicate rows from being inserted.
Hope it Helps,
-Jason Garber
Lead Programmer - pulseaday.com
At 08:07 AM 8/23/2001 -0400, you wrote:
>Hi
>
>Is it possible to use 2 or more fields to become the primary key. I have a
>table
>
>CREATE TABLE tmptraining (
> rowid int(10) unsigned NOT NULL auto_increment,
> sid char(32) NOT NULL default '',
> expiry date NOT NULL default '0000-00-00',
> arenaid tinyint(1) unsigned NOT NULL default '0',
> time time NOT NULL default '00:00:00',
> date date NOT NULL default '0000-00-00',
> equip enum('Y','N') NOT NULL default 'N',
> PRIMARY KEY (rowid)
>)
>
>and I want to constrain the information on four fields; arena, time, date
>and sid. That way if someone clicks the refresh or reload button it will
>not add another row, if all FOUR of the fields have the same value as
>another row. Is there a way to do this?
>
>Thanks
>
>Tim
>
>---------------------------------------------------------------------
>Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail <[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php