|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Query - General - Max of Sums query....
Need help with a query. Imagine the following table:
tblExample ID...Comp...Date.......Value 1....A......1/1/08.....17 2....A......1/1/08.....22 3....A......1/1/08.....19 4....A......1/2/08.....22 5....A......1/2/08.....25 6....A......1/3/08.....15 7....B......1/1/08.....31 8....B......1/1/08.....30 9....B......1/2/08.....28 10...B......1/3/08.....33 What I need is a way to sum each company for each day and then take the max of those sums. For instance, taking the sums of the above companies for each day would yield: Comp...Date.....Value A......1/1/08...58 A......1/2/08...47 A......1/3/08...15 B......1/1/08...61 B......1/2/08...28 B......1/3/08...33 Then, I would need to take the max of these values. So, the overall result of the query should look like this: Comp...Date.....max(value) A......1/1/08...58 B......1/1/08...61 The range is going to specified by the user, but for that given range, I need to sum the values for each day and then take the max and return the day(s) the max occurred and what the max was for each company. Any help would be appreciated. |
|
#2
|
||||
|
||||
|
__________________
Come JOIN the party!!! Quote of the Month: Trouble: Luck can't last a lifetime unless you die young. Questions to Ponder: Do cemetery workers prefer the graveyard shift? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Query - General - Max of Sums query.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|