Thank you Kees. While not achieving exactly what I was thinking of
(the total is in an extra row at the end of the selected rows rather
than a column in each row), this will work for me.
Pete Haworth
http://www.mollysrevenge.com
http://www.sonicbids.com/MollysRevenge
http://www.myspace.com/mollysrevengeband
On Nov 15, 2009, at 4:00 AM, [email protected] wrote:
Make that:
SELECT 'detail' AS Descr,
CASE
WHEN <condition> THEN <calculation>
ELSE <calculation>
END AS CalcA
FROM yourtable
UNION
SELECT 'total' AS Descr sum(
CASE
WHEN <condition> THEN <calculation>
ELSE <calculation>
END
) AS CalcA
FROM yourtable;
(untested)
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users