Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Access Query Question

  • 26-11-2003 7:45pm
    #1
    Registered Users, Registered Users 2 Posts: 1,785 ✭✭✭


    I have a table created in Access, it consists of 11 columns with the first two holding names and then 8 holding numbers and the last 1 then holding an average of the previous 8.

    My problem is showing the average, i'm trying to hook this table upto a website using asp but i dont know much about access and am at a loss with this average stuff any one to the rescue?

    Cheers
    Farlz


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Ummm....without being nasty....is this a college project?

    The reason I'm asking is because if your field *holds* the average, then storing or displaying it is no different to storing or displaying any other field....so I fail to see why its a problem.

    And I'm pretty sure you don't mean "how do I calculate an average".....

    Maybe you're not explaining the problem well, or my tired brain is just not understanding it.

    jc


  • Registered Users, Registered Users 2 Posts: 1,785 ✭✭✭Farls


    My mistake i meant the average of a row, i have the 8 fields showing scores and then i'm using the last field to show the average of the previous 8.

    I am using this in college not for a project though and its not an assignment i'm just trying to do something snazzy with asp and i'm not that hot with access.

    Don't worry i'm using boards a long time and know better than to look for somebody to do my "homework"

    If you can help then i'd be obliged but if not then ok i'll do it another way

    Farlz


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Let me see if I understand you....

    You have 11 fields you want to display. 2 text, 9 numeric

    You can apparently do the 2 text and 8 of the 9 numeric fine, from what you're saying. So why is the 9th numeric field any different in how its displayed? Answer - it isn't. Its just another numeric value to be displayed.

    So surely your problem is "how do I calculate the average of 8 numbers", not "how do I display a 9th number". Because if its pre-calculated for you, then it is handled 100% exactly the same as the other numeric values, which you don't seem to have a problem with. I'm assuming its pre-calculated because you mentioned your table had 11 fields. If that was incorrect, then lets assume you have to calculate it yourself.

    Well, there's a myriad of ways of calculating an average. The easiest would be to do it in SQL when retrieving the data....because then when you get to writing the display code, you have 2 text and 9 numeric values....and you knew how to handle 2 text and 8 numeric values so it should be easy :)

    So, are you really asking how to calculate an average in SQL, or am I just completely misunderstanding where your problem lies?

    jc


  • Registered Users, Registered Users 2 Posts: 1,785 ✭✭✭Farls


    Thats basically it, i want to create a query to automatically show up the average of the 8 numeric fields in a 9th one. And i don't know much about databases


    |text|text|num|num|num|num|num|num|num|num|avg|


    thats what i want it to look like with avg showing the average of the 8 numbers.

    I'm about to give up on this and just write the average in the asp code.

    Cheers anyways

    Farlz


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    SELECT (score_a +  score_b +
     score_c + score_d + 
    score_e + score_f + 
    score_g + score_h) / 8
    FROM demo
    where id = [i]n[/i]; 
    
    

    That'll give you the average. You could use this in an update statement too.

    Or you could use the Desktop Edition of Sql Server and put all of it into a stored procedure.


  • Advertisement
Advertisement