At 12:12 +0200 5/5/04, Gerhard Gaupp wrote:
>Hello
>
>I'm looking for something like
>
>if not exists( select 1 from PERSON where NAME = 'Test' ) then
> insert into PERSON ( NAME ) values ( 'Test');
>end if;
>
>I did it with Sybase Database.
>I need to get Data from Excel and have to be shure that there is no
>data more than once in the table.
>So I have to generate a script with test, if this data is in teh
>table yet, or not, before inserting.
Maybe you could just use INSERT IGNORE ... SELECT FROM ... ?
That inserts records from one table into another table, ignoring
records that duplicate any existing unique key values.
>
>Did You Understand? Sorry for my English
>
>Greetings from Germany
>
>Gerhard
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
| Thread |
|---|
| • if exists | Gerhard Gaupp | 5 May |
| • Re: if exists | Paul DuBois | 5 May |