Re: Insert non duplicate data



INSERT INTO test (X,Y)
SELECT '1','2'
WHERE NOT EXISTS(SELECT 1 FROM test WHERE X='1' AND Y='2')

"Leo" <Leo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1736A83A-FA81-46CA-A95A-4D0582E28BFC@xxxxxxxxxxxxxxxx
> I'm trying to construct an insert statement which will only insert data if
> it
> hasn't been inserted before in the same table, i.e. insert x,y into table
> where not exists (select x,y from table), or some such statement. Is there
> an
> easy way of doing this - maybe an if statement that selects x,y and if
> they
> don't exist they are inserted? What would the syntax of such a query be?


.