create table t1 (rpsIndex INTEGER); create table t2 (rpsIndex INTEGER); create table t3 (rpsIndex INTEGER);
insert into t1 values (1); insert into t1 values (1); insert into t1 values (2); insert into t2 values (1); insert into t2 values (2); insert into t2 values (3); insert into t3 values (3); insert into t3 values (3); insert into t3 values (3); select rpsIndex, count(1) frequency from ( select rpsIndex from t1 union all select rpsIndex from t2 union all select rpsIndex from t3 ) group by rpsIndex; - Trey jrpfinch wrote: > I have three tables, each of which has the column rpsIndex. This column is > not a unique index/primary key. > > I would like to count the number of times each rpsIndex appears in all three > tables. E.g. > > Table1 > rpsIndex=1 > rpsIndex=1 > rpsIndex=2 > Table2 > rpsIndex=1 > rpsIndex=2 > rpsIndex=3 > Table3 > rpsIndex=3 > rpsIndex=3 > rpsIndex=3 > > Query would return: > rpsIndex Frequency > 1 3 > 2 2 > 3 4 > > It is possible to do this in pure SQL in SQLite? > > Many thanks > > jon > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users