SELECT AVG(value) FROM (
SELECT
CASE unit
WHEN "cm" THEN value
WHEN "in" THEN value*2.54
END AS value
FROM data_table
) AS all_in_cm
SELECT AVG(value) FROM (
SELECT
CASE unit
WHEN "cm" THEN value
WHEN "in" THEN value*2.54
END AS value
FROM data_table
) AS all_in_cm