MYSQL - Using AVG() and DISTINCT together
12,309
SELECT col2,
AVG(col1)
FROM table
GROUP BY col2
Author by
tim
Updated on July 24, 2022Comments
-
tim almost 2 years
How can you write the following in MYSQL?
SELECT AVG(col1) FROM table WHERE DISTINCT col2
more info:
table col1 | col2 ----------- 2 | 555.555.555.555 5 | 555.555.555.555 4 | 444.444.444.444
returns '3'
Basically I'm trying to select average value of col1 where ip addresses in col2 are distinct.