You are going to have to lay out some sample data and desired results.Simple math is just that, simple math. Not sure what you are looking for but here are same basic examples. Best I can do for you without sample structure/data/example/desired results..Create Table #foo (SampleID tinyint not null,Hours int not null, Dollars numeric(12,2) not null)Insert INto #foo (SampleID,Hours, Dollars)Select 1,10,100.50 UNION ALLSelect 1,7,100.50 UNION ALLSelect 1,15,100.50 UNION ALLSelect 1,17,100.50 UNION ALLSelect 2,11,110.50 UNION ALLSelect 2,12,110.50 UNION ALLSelect 2,19,110.50 UNION ALLSelect 2,9,110.50 UNION ALLSelect 2,12,110.50 UNION ALLSelect 2,14,110.50 UNION ALLSelect 2,12,110.50 UNION ALLSelect 3,22,150.00 UNION ALLSelect 3,16,150.00 UNION ALLSelect 3,12,150.00 Select SampleID,Avg(Hours) as Avg_Hours, Avg(Dollars) as Avg_Dollars, Avg(dollars/hours) as Avg_RateFROM #fooGroup by SampleID--orSelect SampleID,Avg(Avg_Dollars)/Avg(Avg_Hours) as Avg_RateFROM (Select SampleID,Avg(Hours) as Avg_Hours, Avg(Dollars) as Avg_Dollars, Avg(dollars/hours) as Avg_Rate FROM #foo Group by SampleID) aGroup by SampleIDDrop Table #foo
Poor planning on your part does not constitute an emergency on my part.