Mysql
 sql >> Database >  >> RDS >> Mysql

Come convertire condizionalmente pollici in cm in MySQL (o conversioni simili durante SELECT)?

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