Subject RE: [firebird-support] Average Average!
Author Peter Gore
Sorry that should be
Branch Clerk Average_Transaction_Value
1 1 2.65 ((1.10 + 3.25) + 0.95)/2
2 1 1.05 ( (1.10 +0.50) + 0.50) /2
2 2 1.50 (0.95 + 0.55) / 1
2 3 9.99 (9.99) / 1
Etc...
Doh
-----Original Message-----
From: Peter Gore [mailto:peter@...]
Sent: 21 April 2004 18:47
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Average Average!

Hi,
That gives me average item value and not average transaction value. What I
need from the table below is:-
Branch Clerk Average_Transaction_Value
1 1 8.00 ((1.10 + 3.25) + 0.95)/2
2 1 1.05 ( (1.10 +0.50) + 0.50) /2
2 2 1.50 (0.95 + 0.55) / 1
2 3 9.99 (9.99) / 1
Etc...
So I have to sum the item values for each transaction per clerk per branch
then divide the answers by the number of transactions per clerk per branch.
Peter Gore

-----Original Message-----
From: Steffen Heil [mailto:lists@...]
Sent: 21 April 2004 18:29
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Average Average!

select branch, clerk, avg( value ) group by branch, clerk

If you need something else, please explain it more in detail.


-----Original Message-----
From: gorepj [mailto:peter@...]
Sent: Wednesday, April 21, 2004 8:16 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Average Average!

Hi all,
here's my table

MyTable

Branch Clerk transaction item value
1 1 1 1 1.10
1 1 1 2 3.25
1 1 2 1 0.95
2 1 1 1 1.10
2 1 1 2 0.50
2 1 2 1 1.10
2 2 3 1 0.95
2 2 3 2 0.55
2 3 4 1 9.99
etc...
What I need to get is average transaction value by branch by clerk from a
single query. So I need to sum values for each transaction by clerk by
branch then average those summed values so I have what I need, average
transaction value by clerk by branch. I've trie but no luck so far. Any
ideas?
Regards
Peter Gore





Yahoo! Groups Links









Yahoo! Groups Links










Yahoo! Groups Links