Thanks,

I will answer to both postings:

Unique index and using replace into ... changes the primary key value, 
what I cannot handle yet, because I am using triggers
to force foreign key referential integrity and updating is not yet 
implemented.



Am 11.05.2008 um 04:23 schrieb Harold Wood & Meyuni Gani:

> Better would be
> Insert into tablea(ida, value1a)
> Select idb, value1b
>       from tableb
>       where idb not in(select ida from tablea);
>

I do not understand this. Do I have to use a second table, tempory 
table or alias ?

If my table is Application, is this then correct ?

INSERT INTO "Application" (id, name) SELECT id, 'lbDMF Manager' from 
"Application" where id not in (SELECT id from "Application")

It works syntactically (in sqliteman) but has no effect.

Thanks

Lothar

> Woody
> from his pda
>
> -----Original Message-----
> From: Lothar Behrens <[EMAIL PROTECTED]>
> Sent: Saturday, May 10, 2008 2:23 PM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] CASE WHEN sample ?
>
> Hi,
>
> I am searching for a sample that uses the case when expression.
> I like to insert values into a table when these values are not in that
> table before.
>
> My tries to read, understand and try the documentation of expressions
> failed.
>
> Executing this statemen twice creates two rows:
>
> replace into anwendungen (name) values ('lbDMF Manager')
>
> This is pseudo code:
>
> if not exsists (select id from mytable where name = 'some name')
>       insert into mytable (name) values ('some name')
>
> Is this possible ?
>
> Thanks
>
> Lothar
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to