craigorama
Technical User
In my table I have 2 columns with x,y points and I need to remove any rows where there are 'wacky points' (basically points that are obviously not in synch with the rest of the points in the table).
I'm trying to construct an SQL query that calculates an average for each column and then removes rows where the values are outside a set tolerance value.
I tried to do something like the statement below but got an error saying I cannot have an agregate function in the where clause:
SELECT *
FROM TELLUS_TEMP_UPLOAD
WHERE COLLAR_LAT < (Avg(COLLAR_LAT)-50)
OR COLLAR_LAT > (Avg(COLLAR_LAT)+50)
OR COLLAR_LNG < (Avg(COLLAR_LNG)-50)
OR COLLAR_LNG<(Avg(COLLAR_LNG)+50);
How would i go about selecting, then deleting the rows that fall with the values stated above?
Thanks!
I'm trying to construct an SQL query that calculates an average for each column and then removes rows where the values are outside a set tolerance value.
I tried to do something like the statement below but got an error saying I cannot have an agregate function in the where clause:
SELECT *
FROM TELLUS_TEMP_UPLOAD
WHERE COLLAR_LAT < (Avg(COLLAR_LAT)-50)
OR COLLAR_LAT > (Avg(COLLAR_LAT)+50)
OR COLLAR_LNG < (Avg(COLLAR_LNG)-50)
OR COLLAR_LNG<(Avg(COLLAR_LNG)+50);
How would i go about selecting, then deleting the rows that fall with the values stated above?
Thanks!