Anand Buddhdev <[EMAIL PROTECTED]> wrote:
> 
> 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.

No, you can't do in the above way. You can first check with SELECT statement if 
address or alias already exists.



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




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

Reply via email to