I am trying to select a table column by
putting the average of that column if any of the values is 0.
SELECT IF(my_column= 0, AVG(number), number) FROM table;
SELECT IF(my_column= 0, 100, number) FROM table;
You can cross-join with a subquery that selects the average and then use that:
SELECT IF(t.my_column=0, a.avg, t.number) FROM table t, (SELECT AVG(number) AS avg FROM table) a