Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6142625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:24:48+00:00 2026-05-23T18:24:48+00:00

I have the following situation on my database: id: | second id: | value

  • 0

I have the following situation on my database:

        id:   |   second id:  |  value 
Row 1:  1     |    1          |   123
Row 2:  1     |    2          |   234
Row 3:  1     |    3          |   456
Row 4:  2     |    1          |   987
Row 5:  2     |    2          |   876
Row 6:  2     |    3          |   765
Row 7:  3     |    1          |   345
Row 8:  3     |    2          |   678
Row 9:  3     |    3          |   543
Row 10: 4     |    1          |   345 
...

For each id I have 3 second ids, they are always 1,2 and 3.
What I need to do is get the average of this 3 values (contemplating the 3 valus for id) and get the average of them. I need to do this with a long table (I was wondering about creating a specific view to do this).

Any help will be welcome.

(Sorry for my question, but i really begginer on SQL Server)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:24:48+00:00Added an answer on May 23, 2026 at 6:24 pm

    Just use AVG and group by each id only.

    SELECT id, AVG(value)
    FROM MyTable
    GROUP BY id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've encountered the following situation in our database. We have table 'A' and table
In a database I have a following situation, A has many B 's and
I have the following situation. I have a database of transactions about multiple contracts.
I am solving following situation - I have in table in database data and
I got the following situation: I have an application configuration in my database which
Imagine following situation: There is a distributed key/value database stored on computer network. One
I have following situation: I have loged user, standard authentication with DB table $authAdapter
I have following situation. A main table and many other tables linked together with
I have following situation. In a constructor of a pseudo class I attach a
I have following situation (simplified, of course): MyDomain.groovy: class MyDomain { MyAnotherDomain anotherDomain //

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.