We all know UPDATE sometimes is limited so in order to make some complex conditional updating we can only rely on the complexity of WHERE clause.
I would like to update my detail table based on master properties (so to set some value only if the corresponding master record fits some conditions). In case of only one property the statement can look like this UPDATE detail_table SET somefield=somevalue WHERE (SELECT masterfieldtocheck FROM master_table WHERE master_table.id =detail_table.masterid)=okvalue Is there a way to alias the master table when I need to check several fields of the master table? Or the only choice is to write WHERE ((SELECT masterfieldtocheck FROM master_table WHERE master_table.id=detail_table.masterid)=okvalue) AND ((SELECT masterfield2tocheck FROM master_table WHERE master_table.id =detail_table.masterid)=okvalue2) If I still need to repeat a similar select statement in the second section, is sqlite optimizer smart enough to recognize that the both parts queries the same record and not to perform this operation several times? Thanks Max, maxerist.net _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users