473,418 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Adding up only highest 7 numbers in a table

489 256MB
I have a table that can contain up to 12 entries for an individual in the number field each number can be different number I want only to add up the top 7 numbers for each individual. What's the easiest way to do this.

Thanks
Jun 10 '23 #1
1 20571
cactusdata
214 Expert 128KB
You will need a unique Id for each record. Then:

Expand|Select|Wrap|Line Numbers
  1. Select IndividualId, Value
  2. From YourTable
  3. Where Id In
  4.     (Select Top 7 T.Id
  5.     From YourTable As T
  6.     Where T.IndividualId = YourTable.IndividualId
  7.     Order by T.Value Desc, T.Id)
Jun 14 '23 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sreya | last post by:
Hello..I hope someone can help me with this little that I've been having for a while. I have a form..which has many fields. one of them being a test #. what I need a combo box with only certain...
8
by: k | last post by:
Hi all I split a database in a table-part and a all-the-rest-part and linked the tables, but my code adding records to a table crashes on Set rs = db.OpenRecordset("tblDeltakelse",...
3
by: Bisley | last post by:
I wish to restrict my textbox to only accepting numbers I have looked the textbox KeyDown event and can inspect KeyEventArgs parameter and interogate which key has been pressed, but I can't work...
3
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple...
1
by: Klaasjan Mors | last post by:
Hi, I have the following problem. In a datetimepicker i want to enter only using numbers. eg. date 01-12-2003 Now you have to use a arrowkey after 01 and 12 I want to continu automatic after...
8
by: Mike L | last post by:
In VB.NET Windows Form, how do I set my text box to only allow numbers?
2
Ajm113
by: Ajm113 | last post by:
I want to have a textbox that only allows Numbers, Periods, Spaces, and Minuses in it using C#. How is this accomplished? I already have the code set up like this: private void...
4
by: someone124 | last post by:
Hi, everyone. I'm trying to find the lowest and the highest numbers that a user has had punched in. The code includes a user punching in 4 different numbers, each on a different line. I need help...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.