Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Grouping data for more efficient data selection Rate Topic Display Mode Topic Options
Author
 Message
 Posted Monday, November 4, 2013 1:09 PM
 Grasshopper Group: General Forum Members Last Login: Monday, December 8, 2014 9:37 AM Points: 10, Visits: 75
 I have a table containing 50000 records. The fields are, Phase, KVA, Amt and Group. To begin with, Group = 0 for all records. I have an input variable #Grps, telling me how many final groups the user wants. I am to determine the groups by Phase, KVA, and AMT in that order. For instance, All records with Phase = 1, KVA = 25 and AMT <= xxx would go into Group = 1, All records with Phase = 1, KVA = 25, Amt > xxx and Amt <= yyy would go into Group = 2, etc. until the maximum amt has been assigned to a group for this Phase and KVA. Then we would go to Phase 1, KVA = 50, and do it all over again. I know there's a formula for this, but I've been out of school a long time, and don't remember enough to find it on the internet. Can anyone reading this tell me what the formula is, or give me an efficient query to accomplish my goal?The amount ranges are determined by the number of records (#Recs) in that grouping (Phase = 1, KVA = 25) divided by the total number of records(#TotRecs) times the #Grps, which gives us the number of groups allotted to this grouping (#SubGrps), so the number of records in each group within that grouping would be #Recs/#SubGrps or xxx in my example above. yyy would then be twice that amount.This will require some tweaking, but if I can get this far, I can handle the rest.Thanks guys #
Post #1511267
 Posted Monday, November 4, 2013 1:17 PM
 Hall of Fame Group: General Forum Members Last Login: Today @ 12:08 PM Points: 3,321, Visits: 32,657
 some scripts to define table along with example data and expected output from example data will help considerably please. ______________________________________________________________you can lead a user to data....but you cannot make them think and remember....every day is a school day
Post #1511270

 Permissions