On 7 Jan 2017, at 2:27pm, Gan Uesli Starling <g...@starling.us> wrote:
> CREATE TRIGGER _160m_Increment > AFTER UPDATE ON qso WHEN > NEW.freq LIKE '1.%' > BEGIN > SELECT country AS c FROM qth WHERE rowid = NEW.qth_other_id; > SELECT state AS s FROM qth WHERE rowid = NEW.qth_other_id; > UPDATE usa_state SET _160m = 1 + (SELECT _160m FROM usa_state WHERE state > = s) WHERE state = s AND c = 'USA'; > UPDATE mx_state SET _160m = 1 + (SELECT _160m FROM mx_state WHERE state = > s) WHERE state = s AND c = 'Mexico'; > UPDATE ca_prov SET _160m = 1 + (SELECT _160m FROM ca_prov WHERE prov = > s) WHERE prov = s AND c = 'Canada'; > UPDATE world SET _160m = 1 + (SELECT _160m FROM world WHERE country = > c) WHERE country = c; > END; Other have told you that SQLite does not have variables. But ask yourself why you are bothering to keep a running total. Why not just have SQLite calculate these numbers when you need them ? With the correct indexes the calculation should take very little time. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users