-
Is there a way to obtain the average of two fields?
I am putting together a database of football stats. in this database I am keeping rushing yards and average rush per yard. Is there a statement that will display the average of the Attempts field and Yards field? I noticed in the tutorials there is a way to do it with columns, but this would be averaging a two fields in a row.
Thanks,
David
-
please provide us what database you are using oracle,sql, access, mysql , sybase etc.
and provide example
-
I am using FrontPage, so the database is Access. Here are the fields...
Player, Attempts, Yards, Average, Touchdowns
I'm assuming this would be a Select statement to display the average yards per attempt.
Select *
From results
Avg ???????
Where player = '::J. Fiedler::'
As you can tell, I'm a sure newbie. Thank you for your help
-
--For total average
SELECT avg(attempts/yards)
FROM Table1 where player ='J. Fiedler'
--For individual average
SELECT attempts/yards
FROM Table1 where player ='J. Fiedler';
--I dont know what this is
SELECT sum(attempts)/sum(yards)
FROM Table1 where player ='J. Fiedler'
-
That worked out great. Thanks so much. Is there a way to shorten the values outcome? Currently it displays 4.5396543, where I'd like it to say 4.5
Thanks so much for your help.
David
-
--for 2 decimal places
SELECT format(attempts/yards,"####.##")
FROM Table1 where player ='J. Fiedler';
--for 1 decimal places
SELECT format(attempts/yards,"####.#")
FROM Table1 where player ='J. Fiedler';
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|