mrclay.org
Average direction in SQL
Given a column of polar directions in degrees, this is a single SQL expression to compute their average, for use in a GROUP BY query. Some functions may be MySQL-specific. IF(DEGREES(ATAN2( -AVG(SI…