sql server - Aggregate Function Group by Error -
The following is how I created the table:
create table #tmp ([counter ] ET, not taped per day, Cam Float, Camemag Float, HFX Float, HFX Mate Float, Toremetic Float) The following is the following that I call on my desk in my script: SELECT ((ROW_NUMBER (per ROW_NUMBER) (1) / @ Avg) as a counter [counter], per, cam, average camimetric (chemmetric), HFXME, From # [Counter] by TMP group; Drop Table # TAP The following errors I get:
Message 8120, Level 16, State 1, Line 175 Column '# TMP Per' Featured The list is invalid because it is not contained in a composite function or group by section.
Message 8120, Level 16, State 1, Line 175 column is on '# TMP.' is invalid in the selection list because it is not contained in a composite function or Group BY clause.
What am I doing wrong?
The data looks like the following
counter --- per --- cam --- hfx mail --- --- 1. 2012-02-09 3 16 1 2012-02-24 4 12 1 2012-03-04 2 15 2 2012-03-15 1 18 2 2012-03-30 6 20 2 2012-04-07 10 6 3 2012-04-28 8 3 Now I want to add two more columns named Camimetric AVG and HFX Metric, which will see all the counters in 1 and then get the Cametratic and HFX metric values respectively and give average and on each Keep like the following:
per-copy - - cam --- cammart --- 1 2012-02-09 3 3 1 2012-02-24 4 3 1 2012-03-04 2 3 2 2012-03-15 1 5.6 2 2012-03-30 6 5.6 2 2012-04-07 10 5.6 3 2012-04-28 8 8
SELECT [counter], period, cammatic, agkam metric = AVG (camimetric) over (part of the counter), HFX metric, AGHFXM metric = AVG (HFX metric) over (part of the counter) ... for other metrics Repeat ... by #TmpTransHrsData Group [Counter], Period, Camimetric, HFX Mate Rick;
Comments
Post a Comment