Thank You Works well summing the columns but I don't get a 'tot' label I, get
1 54 3 2 26 4 3 56 8 0 136 15 On 22 February 2013 23:20, Clemens Ladisch <[email protected]> wrote: > Paul Sanderson wrote: > > SELECT cat, COUNT(*) AS occ, COUNT(DISTINCT tes) AS uni, COUNT(tag) AS > > tagged FROM rtable WHERE qu > 0 AND qu < 4 GROUP BY qu > > > > The table would look something like > > > > 1 54 3 > > 2 26 4 > > 3 56 8 > > > > I want to modify the above sql query to sum the second and third columns > > and get a resultant table something like > > > > 1 54 3 > > 2 26 4 > > 3 56 8 > > tot 136 15 > > Use UNION to add a second subquery without grouping: > > SELECT ...your query... > UNION ALL > SELECT 'tot', COUNT(*), COUNT(DISTINCT tes), COUNT(tag) > FROM table > WHERE qu BETWEEN 1 AND 3 > > > Regards, > Clemens > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel +44 (0)1326 572786 _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

