On 4 Apr 2011, at 4:26pm, Marcelo Serrano Zanetti wrote:

> About the "new" item, yes I do compare some specific fields and not the 
> primary key. For example name and surname of a person ... I look in the 
> database for such a person ... if yes I return her id ... if not I 
> include her and then return her id ... so I thought it would be more 
> efficient to construct a single query that does all the job avoiding 
> multiple queries.

Probably not.  Don't try to turn SQL into a procedural language.  Do the SELECT 
that tells you whether the record exists and gives you the information you need 
if it does, then do whatever INSERTs you need to do.

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

Reply via email to