Newbies NoahR Posted July 19, 2004 Newbies Posted July 19, 2004 In a database I have a bunch of records about people, and each person is designated by a unique ID code. There are multiple records for each person, though (each record represents one person for a particular year). What I want to do is sum the data over all the years for each particular person in a new table (or a new database). Anybody have any ideas? Maybe a script?
DanBrill Posted July 19, 2004 Posted July 19, 2004 So each record for a person has the same person-ID number attached to it, regardless of the year? I'm assuming yes. If so, you want to create a self-join relationship. If your table is called people, create another table occurence (TO) called People2. Relate them by the ID number. THen create a calc field for your sum: sum(People2::YourDataField) This will give you the sum for each person across all years for that data. HTH, Dan
Newbies NoahR Posted July 19, 2004 Author Newbies Posted July 19, 2004 Yep, that works beautifully, thanks.
Tanner Posted July 30, 2004 Posted July 30, 2004 I have a similar setup on one of my databases so I tried this suggestion. It worked great, except when the total is a negative number. For example if I have two records that should add up to -150 it says -250. Any ideas what might cause this? -Tanner
Tanner Posted July 30, 2004 Posted July 30, 2004 Just a quick update. The negative numbers actually are double what they should be. So if the number is supposed to be -25 it reads as -50. Any ideas would be greatly appreciated.
Recommended Posts
This topic is 7682 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now