I have a table with multiple readings_miu_id's each with multiple RSSI readings (RSSI is also the name of the field). So, i currently have a datasheet, with many columns, but the two pertinent ones to this conversation look something like this:
readings_miu_id RSSI
=============== ====
11011032 -90
11011032 -81
11011032 -62
11011032 -84
11011032 -86
11010084 -84
11010084 -86
11010084 -87
and so on.
My original plan was to change the value of RSSI for each record having the same readings_miu_id with the average RSSI for that readings_miu_id (which should look the same as above except that the individual RSSI's will be replaced by the average RSSI for that miu), and then pull only one record for each distinct readings_miu_id (which I'm pretty sure I can do with the select top 1 type statement.) However I'm having problems figuring the first part out. The sql statements I've tried that seem like they should be close are:
UPDATE analyzedCopy2 as A
SET analyzedCopy2.RSSI = Avg(RSSI)
where readings_miu_id = A.readings_miu_id
and
UPDATE analyzedCopy2 as A
SET RSSI = Avg(select RSSI from analyzedCopy2
where readings_miu_id = A.readings_miu_id)
WHERE readings_miu_id = A.readings_miu_id;
Help please!