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

Reply via email to