Robert Martin wrote:

> Hi,
>
> I?m still learning sql so I hope this doesn?t sound to basic.
>
> I would like to find out if there is a way to insert a record only when (X and Y) do 
>not exist.
> I have the value to check against stored in a variable.

ALTER TABLE table ADD UNIQUE u_xy_idx ( x, y );

Then when you go to insert a duplicate x,y you will get an error from MySQL.

--Bill



---------------------------------------------------------------------
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

Reply via email to