You
really want to do this in your client.
The only way I can see to do this is with a bunch of subqueries:
Code:
SELECT SUM(YourField), SUM(YourField-TheAve)/(SELECT STDEV(YourField) FROM YourTable)
FROM (SELECT YourField, (SELECT AVG(Amount) FROM YourTable) AS TheAve
FROM YourTable) AS TheData
This will get hideous fast as the complexity (JOINS, WHERE clauses, etc.) of the base query increases. Not to mention probably slow. Do it in the client. :)
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com