[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ProgSoc] Statistics from a database




Quoting Romney Lai <romney.lai@nospam.billback.com>:

> maybe i am missing something here. cant you get the number of tow by a
> query like 
> SELECT     COUNT(*) 
> FROM         (SELECT DISTINCT tow FROM TOWS) ?
> 
> If you can do that, you can calculate the mean/average fairly easily.

Yes, it's possible to determine the count 'n' of tows for any particular 
grouping I chose, for instance, tows grouped by Location (a field of Tows), 
using a query similar to the one you suggested. Note that this query only 
examines the Tows table.

However, I'm not sure how to integrate this number 'n' into a query involving 
the TowCounts table, since the rows to calculate 'n' may be missing after you 
join the tables.

Can I do it using a sub-query?

I can get the data required to calculate the correct means, however, it 
requires two queries: one to calculate 'n' and one to calculate the totals. The 
results of the two queries then have to be combined manually. This is time-
consuming and error-prone.

Cheers,
Jay.

-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.