I have:Select stdev([Reg Hrs]) as StdDev, Avg([Reg Hrs]) as Mean, WC, Wop, Itemfrom tblHistorywhere [Reg Hrs] <> .1 and [Reg Hrs] <> 0group by WC, Wop, Itemorder by WC, Wop, Item
This works fine, as far as it goes. But I also need to eliminate all rows from the Stdev calculations where [Reg Hrs] is >= +/- 3 std deviations for each distinct group of WC, Wop and Item. When I try to add that criteria to the Where clause I get an error: An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.I did try putting it in a HAVING clause (never used this before) but: Column 'CumulativeHistoryFromSyteline.Act Reg Hrs' is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY clause. Please show me how to structure the query I need or point me in the right direction. Thanks!Thank you,LadyReader