On 04/03/2011 03:12 PM, Igor Tandetnik wrote: > Marcelo S Zanetti<mszane...@yahoo.com> wrote: >> I >> have an item to insert in the table which will be inserted only if this >> item is not yet in that table otherwise I would like to return the >> item's key. >> >> like that >> >> IF 1==SELECT COUNT(*) from table >> WHERE item==new THEN SELECT itemID from tabel WHERE item==new ELSE >> INSERT INTO table (item) VALUES (new) >> >> It does not work in this way ... could somebody tell me please what is the >> correct sintax or whether this is possible at all. > You use SQLite API to execute the three SQL statements, and use whatever > programming language your host application is written in to implement the > surrounding logic. Thank you Igor!
I thought it could be organized in a single query ... like you said, the only way I managed to do it was using three separated queries. Best Marcelo _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users