Statistics

orbic1

Registered User.
Local time
Today, 00:04
Joined
Mar 3, 2004
Messages
46
I'm trying to base reports upon various data to be used for statistical analysis. Presumably these reports need to be based upon queries. I'm about there with what I need to do, but am not sure. Below are a list of queries that I need to find, but I need to find the number of rows / records, not the actual data itself. Or, better yet, the data with the number of rows aswell.

Gender - No. Male, No. Female, Total
-> a percentage would be nice here too.

No "Active" Records in a Table defined by checkbox

Cheers
 
Do some research on totals queries. You will find you can calculate sums, count records and calculate various statistical values like arithmetic mean (average).

When you're using checkboxes, be aware that true or yes is stored as -1 and false or no is 0. Thus the sum of such a field will return the number of true values, albeit with a negative sign.
 
Thanks - will give it a shot!
 
If you want different rows with the data:
SELECT "MALE" as Desc, COUNT(*) as Cnt FROM Tbl1 Where Gender = "M"
UNION
SELECT "FEMALE" as Desc, COUNT(*) as Cnt FROM Tbl1 Where Gender = "F"
UNION
SELECT "TOTAL" as Desc, COUNT(*) as Cnt FROM Tbl1 Where Gender in ("M","F")

If you want one row try this:
SELECT (SELECT COUNT(*) FROM Tbl1 WHERE Gender = "M") as MaleCount,
(SELECT COUNT(*) FROM Tbl1 WHERE Gender = "F") as FemaleCount,
(SELECT COUNT(*) FROM Tbl1 WHERE Gender in ("M","F")) as TotalCount

May have to adjust SQL a tad, this is just a couple ways to do it. You could also use group by on gender to get a count and add the two counts together for a total.
 

Users who are viewing this thread

Back
Top Bottom