Hi, Could you just break out the email information into its own table? Then you could have columns like the following:
UserID (foreign key), email (varchar), type (int: 1=primary email, 2=alias email). Then you can just have the email column defined as a unique index and relate the email to the user table using a foreign key. Regards, Colin. -----Original Message----- From: Anand Buddhdev [mailto:[EMAIL PROTECTED] Sent: 27 February 2004 08:50 To: [EMAIL PROTECTED] Subject: unique values across more than one column Hi everyone, I'm using mysql version 3.23.58, on Fedora core 1 (the default supplied on the system). I have searched the mailing list archives, and google, for my query, but have not yet found an answer. Does anyone know if it's possible to define 2 columns in a table, with a constraint that will ensure that values on both columns are unique? For example, if I have columns "a" and "b", then if I insert value "x" in column a, then I may not insert value "x" again in EITHER column "a" or column "b" again. I'm trying to develop a structure for a table that will hold a user's primary email address, and an alias, and I'd like to have a column called "address" and a column called "alias", and of course, there must be no address or alias duplication. This allows addition and removal of an address and its alias in one insert, and if the insert fails, then we know there's duplication, and return an error message. I have thought of other ways around this issue, but my ideal solution would be as above. If this is not possible, then I will go back to my other (IMHO less elegant) solutions. -- Anand Buddhdev Celtel International -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]