-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 22 July 2003 21:56, Greg Macek wrote:
> Hello,
>
> I have a strange question. I'm in the design phase for a table and was
> wondering if it's possible in MySQL to force a pair of fields in a
> record to be unique within the table. I would like it to look like this:
>
> user_id
> job_id
>
> What I'd like to do is never have the same user_id and job_id paired up
> paired together more than once. Maybe I'm missing a better way to setup
> this table. If I am, please let me know. Thanks.

Just create a Unique index. For example if the table is named Tbl then (for 
example)

Create Unique Index IX_Tbl1 on Tbl (user_id,  job_id);

This will allow user_id or job_id to be duplicated in the table, but no 
combination of user_id and job_id can be repeated.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/HfzTjeziQOokQnARAtYmAJ9j7rWWvIbEPkLKcL1oDbdveJJELQCfWkKE
e+BFvxSllsIqZJ5Q3nCeXcg=
=zPh7
-----END PGP SIGNATURE-----


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to